From 5a897b4ec2963d5a35682c89fd7f47020b67d653 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 24 Aug 2022 14:37:06 +0200 Subject: [PATCH] wip #5414 @0.25 --- src/ExcelToArray.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ExcelToArray.php b/src/ExcelToArray.php index 3854070..83e169a 100644 --- a/src/ExcelToArray.php +++ b/src/ExcelToArray.php @@ -4,6 +4,7 @@ namespace Cubist\Excel; use Cubist\Util\Files\Files; use Cubist\Util\Url; +use Exception; use PhpOffice\PhpSpreadsheet\Reader\BaseReader; use PhpOffice\PhpSpreadsheet\Reader\Ods; use PhpOffice\PhpSpreadsheet\Reader\Xls; @@ -39,7 +40,7 @@ class ExcelToArray */ protected static function _loadFile($file) { - $reader = self::_reader(); + $reader = self::_reader($file); return $reader->load($file); } @@ -53,14 +54,14 @@ class ExcelToArray $e = explode('.', $file); $ext = array_pop($e); switch ($ext) { - case 'xlsx': - return new Xlsx(); case 'xls': return new Xls(); case 'ods': return new Ods(); + case 'xlsx': + default: + return new Xlsx(); } - throw new Exception('The file type ' . $ext . ' is not supported'); } public static function excelToArrayRaw($file, $force = false) -- 2.39.5