modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2024-10-03 05:02:29 +04:00
parent c23a8c8c19
commit 431d5a6e80
4 changed files with 8 additions and 8 deletions

View File

@ -106,7 +106,7 @@ class PhpSpreadsheetReader extends AbstractReader {
} }
$row[] = $col; $row[] = $col;
} }
if ($this->cook($row)) { if ($this->cookRow($row)) {
yield $row; yield $row;
$this->idest++; $this->idest++;
} }

View File

@ -106,7 +106,7 @@ class SpoutReader extends AbstractReader {
foreach ($row as &$col) { foreach ($row as &$col) {
$this->verifixCol($col); $this->verifixCol($col);
}; unset($col); }; unset($col);
if ($this->cook($row)) { if ($this->cookRow($row)) {
yield $row; yield $row;
$this->idest++; $this->idest++;
} }

View File

@ -11,7 +11,7 @@ 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? */ /** @var bool faut-il utiliser les en-têtes pour retourner des tableaux associatifs? */
const COOk_ROW = true; const COOk_ROWS = true;
/** @var ?string nom du fichier depuis lequel lire */ /** @var ?string nom du fichier depuis lequel lire */
const INPUT = null; const INPUT = null;
@ -40,7 +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->cookRow = $params["cook_row"] ?? static::COOk_ROW; $this->cookRows = $params["cook_rows"] ?? static::COOk_ROWS;
$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);
@ -52,7 +52,7 @@ abstract class AbstractReader implements IReader {
protected ?array $headers; protected ?array $headers;
protected bool $cookRow; protected bool $cookRows;
protected $input; protected $input;
@ -66,8 +66,8 @@ 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 cookRow(array &$row): bool {
if (!$this->cookRow) return true; if (!$this->cookRows) 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;

View File

@ -27,7 +27,7 @@ class CsvReader extends AbstractReader {
foreach ($row as &$col) { foreach ($row as &$col) {
$this->verifixCol($col); $this->verifixCol($col);
}; unset($col); }; unset($col);
if ($this->cook($row)) { if ($this->cookRow($row)) {
yield $row; yield $row;
$this->idest++; $this->idest++;
} }