Handle empty rows without E_WARNING when filling missing array indexes (#385)
In some cases, reading an XLSX file produce E_WARNING from the max() call in the fillMissingArray() method. This commit fix the problem by handling empty rows.
This commit is contained in:
1 parent
6f4ddb1569
commit
1ce931a424
2 files changed
+19
-5
No files matched your search
@@ -31,6 +31,9 @@ class CellHelper
|
||||
*/
|
||||
public static function fillMissingArrayIndexes($dataArray, $fillValue = '')
|
||||
{
|
||||
if (empty($dataArray)) {
|
||||
return [];
|
||||
}
|
||||
$existingIndexes = array_keys($dataArray);
|
||||
|
||||
$newIndexes = array_fill_keys(range(0, max($existingIndexes)), $fillValue);
|
||||
|
||||
Reference in new issue
Block a user