distinguer cols et row style

This commit is contained in:
Jephté Clain 2024-11-29 15:42:02 +04:00
parent 5c8f26ed16
commit 22c8067c8f
2 changed files with 5 additions and 5 deletions

View File

@ -17,7 +17,7 @@ class CsvBuilder extends AbstractBuilder {
parent::__construct($output, $params);
}
protected function _write(array $row, ?array $rowStyle=null): void {
protected function _write(array $row, ?array $colsStyle=null, ?array $rowStyle=null): void {
$this->fputcsv($row);
}

View File

@ -69,7 +69,7 @@ abstract class AbstractBuilder extends TempStream implements IBuilder {
$this->headers = $headers;
}
protected abstract function _write(array $row, ?array $rowStyle=null): void;
protected abstract function _write(array $row, ?array $colsStyle=null, ?array $rowStyle=null): void;
protected bool $wroteHeaders = false;
@ -101,11 +101,11 @@ abstract class AbstractBuilder extends TempStream implements IBuilder {
return $row;
}
function write(?array $row, ?array $rowStyle=null): void {
function write(?array $row, ?array $colsStyle=null, ?array $rowStyle=null): void {
$row = $this->cookRow($row);
if ($row === null) return;
$this->writeHeaders(array_keys($row));
$this->_write($row, $rowStyle);
$this->_write($row, $colsStyle, $rowStyle);
}
function writeAll(?iterable $rows=null, ?array $rowStyle=null): void {
@ -116,7 +116,7 @@ abstract class AbstractBuilder extends TempStream implements IBuilder {
}
if ($rows !== null) {
foreach ($rows as $row) {
$this->write(cl::with($row), $rowStyle);
$this->write(cl::with($row), null, $rowStyle);
}
}
if ($unsetRows) $this->rows = null;