From 98fcd799c74c31d1f330f1f6e58c5da71ab44553 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Sun, 16 Jun 2024 08:02:18 +0400 Subject: [PATCH] modifs.mineures sans commentaires --- nur_src/v/bs3/vc/CTable.php | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/nur_src/v/bs3/vc/CTable.php b/nur_src/v/bs3/vc/CTable.php index e8236bc..4b53ada 100644 --- a/nur_src/v/bs3/vc/CTable.php +++ b/nur_src/v/bs3/vc/CTable.php @@ -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; }