Skip to content

Commit

Permalink
scrutinizer
Browse files Browse the repository at this point in the history
  • Loading branch information
rap2hpoutre committed Apr 9, 2018
1 parent 5567cd1 commit 2048ef6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Importable.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function import($path, callable $callback = null)
{
$headers = [];
$collection = [];
$count_header = 0;

$reader = ReaderFactory::create($this->getType($path));
$this->setOptions($reader);
Expand All @@ -63,7 +64,7 @@ public function import($path, callable $callback = null)
$count_header = count($headers);
continue;
}
if (($count_header ?? 0) > $count_row = count($row)) {
if ($count_header > $count_row = count($row)) {
$row = array_merge($row, array_fill(0, $count_header - $count_row, null));
}
$collection[] = $callback ? $callback(array_combine($headers, $row)) : array_combine($headers, $row);
Expand Down

0 comments on commit 2048ef6

Please sign in to comment.