FIX: non array rows
This commit is contained in:
@ -16,11 +16,17 @@ class Informe
|
|||||||
{
|
{
|
||||||
$maxCols = 0;
|
$maxCols = 0;
|
||||||
foreach ($data as $row) {
|
foreach ($data as $row) {
|
||||||
|
if (!is_array($row)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (count($row) > $maxCols) {
|
if (count($row) > $maxCols) {
|
||||||
$maxCols = count($row);
|
$maxCols = count($row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($data as &$row) {
|
foreach ($data as &$row) {
|
||||||
|
if (!is_array($row)) {
|
||||||
|
$row = [$row];
|
||||||
|
}
|
||||||
if (count($row) < $maxCols) {
|
if (count($row) < $maxCols) {
|
||||||
$row = array_merge($row, array_fill(0, $maxCols - count($row), ''));
|
$row = array_merge($row, array_fill(0, $maxCols - count($row), ''));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user