From 18b486d0c33161530a3a624c3115fd4be9068ee3 Mon Sep 17 00:00:00 2001 From: Daryl Richter Date: Mon, 19 Feb 2024 13:30:44 -0500 Subject: [PATCH] clean --- src/Exportable.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Exportable.php b/src/Exportable.php index 9054040..366f446 100644 --- a/src/Exportable.php +++ b/src/Exportable.php @@ -87,17 +87,12 @@ public function download($path, callable $callback = null) private function exportOrDownload($path, $function, callable $callback = null) { $ext = strtoupper(substr($path, -3)); - if (in_array($ext, ['CSV', 'ODS'], true)) { + $knownExts = ['CSV', 'ODS']; + if (in_array($ext, $knownExts, true)) { $optionCls = "\OpenSpout\Writer\{$ext}\Options"; $writerCls = "\OpenSpout\Writer\{$ext}\Writer"; $options = new $optionCls(); $writer = new $writerClass($options); - // if (str_ends_with($path, 'csv')) { - // $options = new \OpenSpout\Writer\CSV\Options(); - // $writer = new \OpenSpout\Writer\CSV\Writer($options); - // } elseif (str_ends_with($path, 'ods')) { - // $options = new \OpenSpout\Writer\ODS\Options(); - // $writer = new \OpenSpout\Writer\ODS\Writer($options); } else { $options = new \OpenSpout\Writer\XLSX\Options(); $writer = new \OpenSpout\Writer\XLSX\Writer($options);