Skip to content

Commit

Permalink
fix quality check
Browse files Browse the repository at this point in the history
  • Loading branch information
vdariel committed Oct 23, 2023
1 parent e6c7bc4 commit d90fb25
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
18 changes: 10 additions & 8 deletions src/Exportable.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
namespace Smart145\FastExcel;

use Generator;
use Illuminate\Support\Arr;

use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use InvalidArgumentException;
use OpenSpout\Common\Entity\Row;
use OpenSpout\Common\Entity\Style\Style;
use OpenSpout\Writer\Common\AbstractOptions;
use OpenSpout\Writer\Common\Creator\WriterEntityFactory;
use OpenSpout\Writer\XLSX\Writer;

/**
* Trait Exportable.
Expand All @@ -21,7 +21,6 @@
*/
trait Exportable
{

/**
* @var array
*/
Expand All @@ -34,11 +33,11 @@ trait Exportable
private $rows_style;

/**
* @param AbstractOptions $options
* @param \OpenSpout\Reader\ReaderInterface|\OpenSpout\Writer\WriterInterface $reader_or_writer
*
* @return mixed
*/
abstract protected function setOptions(&$options);
abstract protected function setOptions(&$reader_or_writer);

/**
* @param string $path
Expand All @@ -59,7 +58,7 @@ public function export($path, callable $callback = null)
}

/**
* @param $path
* @param $path
* @param callable|null $callback
*
* @throws \OpenSpout\Common\Exception\InvalidArgumentException
Expand All @@ -74,15 +73,15 @@ public function download($path, callable $callback = null)
if (method_exists(response(), 'streamDownload')) {
return response()->streamDownload(function () use ($path, $callback) {
self::exportOrDownload($path, 'openToBrowser', $callback);
}, $path);
});
}
self::exportOrDownload($path, 'openToBrowser', $callback);

return '';
}

/**
* @param $path
* @param $path
* @param string $function
* @param callable|null $callback
*
Expand Down Expand Up @@ -197,6 +196,7 @@ private function writeRowsFromCollection($writer, Collection $collection, ?calla
foreach ($removableKeys as $toRemove) {
unset($value[$toRemove]);
}

return Row::fromValues($value);
})->toArray();
if ($this->rows_style) {
Expand Down Expand Up @@ -346,6 +346,7 @@ public function rowsStyle(Style $style)

/**
* @param $widths
*
* @return $this
*/
public function setColumnsWidth($widths)
Expand All @@ -355,3 +356,4 @@ public function setColumnsWidth($widths)
return $this;
}
}

15 changes: 8 additions & 7 deletions src/Facades/FastExcel.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
/**
* Class FastExcel.
*
* @method static \Smart145\FastExcel\FastExcel data($data)
* @method static \Illuminate\Support\Collection import($path, callable $callback = null)
* @method static string export($path, callable $callback = null)
* @method static \Illuminate\Support\Collection importSheets($path, callable $callback = null)
* @method static \Smart145\FastExcel\FastExcel configureCsv($delimiter = ',', $enclosure = '"', $encoding = 'UTF-8', $bom = false)
* @method static \Smart145\FastExcel\FastExcel configureReaderUsing(?callable $callback = null)
* @method static \Smart145\FastExcel\FastExcel configureWriterUsing(?callable $callback = null)
* @method static \Smart145\FastExcel\FastExcel data($data)
* @method static \Illuminate\Support\Collection import($path, callable $callback = null)
* @method static string export($path, callable $callback = null)
* @method static \Illuminate\Support\Collection importSheets($path, callable $callback = null)
* @method static \Smart145\FastExcel\FastExcel configureCsv($delimiter = ',', $enclosure = '"', $encoding = 'UTF-8', $bom = false)
* @method static \Smart145\FastExcel\FastExcel configureReaderUsing(?callable $callback = null)
* @method static \Smart145\FastExcel\FastExcel configureWriterUsing(?callable $callback = null)
*
* @see \Smart145\FastExcel\FastExcel
*/
Expand All @@ -29,3 +29,4 @@ protected static function getFacadeAccessor()
return 'fastexcel';
}
}

0 comments on commit d90fb25

Please sign in to comment.