From 5c8f26ed161a14bf82564d8cb9faa6517c86f07c Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Fri, 29 Nov 2024 15:17:29 +0400 Subject: [PATCH] =?UTF-8?q?possiblit=C3=A9=20de=20sp=C3=A9cifier=20le=20st?= =?UTF-8?q?yle=20des=20lignes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- php/src/file/csv/CsvBuilder.php | 2 +- php/src/file/tab/AbstractBuilder.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/php/src/file/csv/CsvBuilder.php b/php/src/file/csv/CsvBuilder.php index 1147e02..c1ac0bc 100644 --- a/php/src/file/csv/CsvBuilder.php +++ b/php/src/file/csv/CsvBuilder.php @@ -17,7 +17,7 @@ class CsvBuilder extends AbstractBuilder { parent::__construct($output, $params); } - protected function _write(array $row): void { + protected function _write(array $row, ?array $rowStyle=null): void { $this->fputcsv($row); } diff --git a/php/src/file/tab/AbstractBuilder.php b/php/src/file/tab/AbstractBuilder.php index 0a48bc9..ba913f4 100644 --- a/php/src/file/tab/AbstractBuilder.php +++ b/php/src/file/tab/AbstractBuilder.php @@ -69,7 +69,7 @@ abstract class AbstractBuilder extends TempStream implements IBuilder { $this->headers = $headers; } - protected abstract function _write(array $row): void; + protected abstract function _write(array $row, ?array $rowStyle=null): void; protected bool $wroteHeaders = false; @@ -101,14 +101,14 @@ abstract class AbstractBuilder extends TempStream implements IBuilder { return $row; } - function write(?array $row): void { + function write(?array $row, ?array $rowStyle=null): void { $row = $this->cookRow($row); if ($row === null) return; $this->writeHeaders(array_keys($row)); - $this->_write($row); + $this->_write($row, $rowStyle); } - function writeAll(?iterable $rows=null): void { + function writeAll(?iterable $rows=null, ?array $rowStyle=null): void { $unsetRows = false; if ($rows === null) { $rows = $this->rows; @@ -116,7 +116,7 @@ abstract class AbstractBuilder extends TempStream implements IBuilder { } if ($rows !== null) { foreach ($rows as $row) { - $this->write(cl::with($row)); + $this->write(cl::with($row), $rowStyle); } } if ($unsetRows) $this->rows = null;