modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2024-06-16 08:02:18 +04:00
parent 88379a441c
commit 98fcd799c7
1 changed files with 2 additions and 12 deletions

View File

@ -348,16 +348,6 @@ class CTable extends ComponentPrintable implements IParametrable {
iter::next($this->ppRows);
}
protected function ensureArray($row): array {
if (!is_array($row)) {
if ($row === null) $row = [];
elseif ($row instanceof BaseArray) $row = $row->array();
elseif ($row instanceof Iterator) $row = iterator_to_array($row);
else throw ValueException::unexpected_type("array", $row);
}
return $row;
}
protected function nextRow(): ?array {
$filterCtx = $this->filterCtx;
$mapCtx = $this->mapCtx;
@ -373,7 +363,7 @@ class CTable extends ComponentPrintable implements IParametrable {
$map = func::_call($mapCtx, [$row, $this->rowKey, $this->rowIndex]);
}
if ($map !== null) {
$row = $this->ensureArray($row);
$row = A::with($row);
$index = 0;
$mapped = [];
foreach ($map as $key => $value) {
@ -389,7 +379,7 @@ class CTable extends ComponentPrintable implements IParametrable {
}
$row = $mapped;
} else {
$row = $this->ensureArray($row);
$row = A::with($row);
}
return $row;
}