modifs.mineures sans commentaires
This commit is contained in:
parent
b3c37a43a4
commit
b7e0085fd7
|
@ -10,6 +10,9 @@ abstract class AbstractReader implements IReader {
|
||||||
|
|
||||||
const HEADERS = null;
|
const HEADERS = null;
|
||||||
|
|
||||||
|
/** @var bool faut-il utiliser les en-têtes pour retourner des tableaux associatifs? */
|
||||||
|
const USE_HEADERS = true;
|
||||||
|
|
||||||
/** @var ?string nom du fichier depuis lequel lire */
|
/** @var ?string nom du fichier depuis lequel lire */
|
||||||
const INPUT = null;
|
const INPUT = null;
|
||||||
|
|
||||||
|
@ -37,6 +40,7 @@ abstract class AbstractReader implements IReader {
|
||||||
#
|
#
|
||||||
$this->schema = $params["schema"] ?? static::SCHEMA;
|
$this->schema = $params["schema"] ?? static::SCHEMA;
|
||||||
$this->headers = $params["headers"] ?? static::HEADERS;
|
$this->headers = $params["headers"] ?? static::HEADERS;
|
||||||
|
$this->useHeaders = $params["use_headers"] ?? static::USE_HEADERS;
|
||||||
$this->input = $params["input"] ?? static::INPUT;
|
$this->input = $params["input"] ?? static::INPUT;
|
||||||
$this->trim = boolval($params["trim"] ?? static::TRIM);
|
$this->trim = boolval($params["trim"] ?? static::TRIM);
|
||||||
$this->parseEmptyAsNull = boolval($params["empty_as_null"] ?? static::PARSE_EMPTY_AS_NULL);
|
$this->parseEmptyAsNull = boolval($params["empty_as_null"] ?? static::PARSE_EMPTY_AS_NULL);
|
||||||
|
@ -48,6 +52,8 @@ abstract class AbstractReader implements IReader {
|
||||||
|
|
||||||
protected ?array $headers;
|
protected ?array $headers;
|
||||||
|
|
||||||
|
protected bool $useHeaders;
|
||||||
|
|
||||||
protected $input;
|
protected $input;
|
||||||
|
|
||||||
protected bool $trim;
|
protected bool $trim;
|
||||||
|
@ -61,6 +67,7 @@ abstract class AbstractReader implements IReader {
|
||||||
protected int $isrc = 0, $idest = 0;
|
protected int $isrc = 0, $idest = 0;
|
||||||
|
|
||||||
protected function cook(array &$row): bool {
|
protected function cook(array &$row): bool {
|
||||||
|
if (!$this->useHeaders) return true;
|
||||||
if ($this->isrc == 0) {
|
if ($this->isrc == 0) {
|
||||||
# ligne d'en-tête
|
# ligne d'en-tête
|
||||||
$headers = $this->headers;
|
$headers = $this->headers;
|
||||||
|
|
Loading…
Reference in New Issue