Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
Daryl Richter committed Feb 19, 2024
1 parent f823cd9 commit 18b486d
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/Exportable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 18b486d

Please sign in to comment.