From 2048ef66479e1c619d059d77ebae786fb0997b7e Mon Sep 17 00:00:00 2001 From: rap2h Date: Mon, 9 Apr 2018 15:19:07 +0200 Subject: [PATCH] scrutinizer --- src/Importable.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Importable.php b/src/Importable.php index 0d0f3f7..f27711d 100644 --- a/src/Importable.php +++ b/src/Importable.php @@ -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); @@ -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);