package and depencies
This commit is contained in:
154
vendor/maatwebsite/excel/CHANGELOG.md
vendored
154
vendor/maatwebsite/excel/CHANGELOG.md
vendored
@@ -1,8 +1,122 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [3.1.45] - 2023-01-02
|
||||
|
||||
### Added
|
||||
- Add support for ignoring PHP auto_detect_line_endings INI directive
|
||||
|
||||
### Fixed
|
||||
- Fix the PSR simple cache dependency mess to maintain backwards compatability and support 3.0 of the interface.
|
||||
|
||||
## [3.1.44] - 2022-10-14
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix output of `WithFormatData` in combination with `SkipsEmptyRows` (#3760)
|
||||
|
||||
### Changed
|
||||
|
||||
- Cast empty headings to indexed integer (#3646)
|
||||
- Adds `isEmptyWhen` to customize is row empty logic. (#3645)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix temporary local files not being cleaned up when setting force_resync_remote config to true (#3623)
|
||||
- Fix testing for multiple stored files by regex matching (#3631).
|
||||
- Allow `required_unless` rule (#3660)
|
||||
|
||||
## [3.1.40] - 2022-05-02
|
||||
|
||||
- Fix testing for multiple stored files by regex matching (#3631).
|
||||
|
||||
### Changed
|
||||
|
||||
- Adds `WithDefaultStyles` concern to allow configuring the workbook default styles.
|
||||
- Adds `WithBackgroundColor` concern to allow configuring the workbook default background color.
|
||||
- Expose the ability to set custom response headers when exporting collections via Exportable
|
||||
|
||||
## [3.1.39] - 2022-04-23
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix PHP8.1 return type for Failure class (#3588)
|
||||
|
||||
## [3.1.38] - 2022-03-24
|
||||
|
||||
### Changed
|
||||
|
||||
- Adds concern `WithGroupedHeadingRow` to allow imported sheets to group the values of columns with the same header in an array
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix for `prepareForValidation` callback not being called when using `SkipsEmptyRows`
|
||||
|
||||
## [3.1.37] - 2022-02-28
|
||||
|
||||
### Fixed
|
||||
|
||||
- Add `@mixin` docblock to all macroable classes to allow for IDE autocompletion of delegate classes
|
||||
- Fix issue with `Excel::toArray` not allowing nullable reader types for uploaded files
|
||||
|
||||
### Changed
|
||||
|
||||
- Change default Csv Import to auto-detect the delimiter when not explicitly defined
|
||||
|
||||
## [3.1.36] - 2022-02-03
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix return type of `FromQuery::query()`
|
||||
|
||||
### Changed
|
||||
|
||||
- Support Laravel 9
|
||||
- Added a config setting to specify DB connection
|
||||
- Added a config setting to specify CSV output encoding
|
||||
- Added an ability to specify CSV ouput encoding through csvSettings
|
||||
|
||||
## [3.1.35] - 2022-01-04
|
||||
|
||||
### Fixed
|
||||
|
||||
- Removed cache flush for cell caching as this is already handled by PhpSpreadsheet
|
||||
- Fix `SkipsEmptyRows` support with the `WithColumnLimit` concern
|
||||
- Added range support to FormatColumn
|
||||
|
||||
## [3.1.34] - 2021-12-2
|
||||
|
||||
### Changed
|
||||
|
||||
- Change default local_path configuration
|
||||
- Fix queueImport function to be able to assert chained jobs
|
||||
- Skipped failure no longer persists in `ToCollection` and `ToArray`.
|
||||
- Fix missing InteractsWithQueue trait in AppendToSheet jobs
|
||||
- Add return types to `Row`'s `ArrayAccess` implementation
|
||||
|
||||
## [3.1.33] - 2021-08-12
|
||||
|
||||
### Fixed
|
||||
|
||||
- Make TransactionManager a singleton (#3270)
|
||||
- Fix Exportable disk options (#3296)
|
||||
- Delete temporary file after exception in import class (#3312)
|
||||
|
||||
## [3.1.32] - 2021-07-08
|
||||
|
||||
### Added
|
||||
|
||||
- Add assertExportedInRaw assertion (#3255)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Make commands detect model directory now (#3213)
|
||||
|
||||
## [3.1.31] - 2021-06-02
|
||||
|
||||
### Added
|
||||
|
||||
- Custom heading row formatter can use column index (#3166)
|
||||
@@ -10,7 +124,11 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Create failures of rows than didn't exists but where requested in row validation
|
||||
- Create failures of rows than didn't exists but where requested in row
|
||||
validation
|
||||
- Fix Bug Formulas are not calculated when import implements
|
||||
WithCalculatedFormulas with SkipsEmptyRows #3127
|
||||
- PhpSpreadsheet 1.18 support
|
||||
|
||||
## [3.1.30] - 2021-04-06
|
||||
|
||||
@@ -59,9 +177,12 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
### Added
|
||||
|
||||
- Added an ability to prepare rows before appending rows to sheet. Just add `prepareRows` method for your export class if needed.
|
||||
- Added an ability to catch exceptions from `QueueExport` job. Just add `failed` method for your export class if needed.
|
||||
- Added an ability to set locale for queued export. Just implement `Illuminate\Contracts\Translation\HasLocalePreference` for your export.
|
||||
- Added an ability to prepare rows before appending rows to sheet. Just add
|
||||
`prepareRows` method for your export class if needed.
|
||||
- Added an ability to catch exceptions from `QueueExport` job. Just add `failed`
|
||||
method for your export class if needed.
|
||||
- Added an ability to set locale for queued export. Just implement
|
||||
`Illuminate\Contracts\Translation\HasLocalePreference` for your export.
|
||||
- Added `JsonSerializable` support in `Maatwebsite\Excel\Validators\Failure`.
|
||||
- Added `$maxExceptions` support in `Maatwebsite\Excel\Jobs\ReadChunk.php`.
|
||||
- Added support to upsert models by implementing the `WithUpserts` concern.
|
||||
@@ -81,6 +202,7 @@ All notable changes to this project will be documented in this file.
|
||||
## [3.1.23] - 2020-09-29
|
||||
|
||||
### Added
|
||||
|
||||
- Added `ignore_empty` setting to `config/excel.php`
|
||||
- Added `strict_null_comparison` setting to `config/excel.php`
|
||||
|
||||
@@ -92,6 +214,7 @@ All notable changes to this project will be documented in this file.
|
||||
## [3.1.21] - 2020-08-06
|
||||
|
||||
### Added
|
||||
|
||||
- Added WithProperties concern
|
||||
- Added default spreadsheet properties config
|
||||
- Added WithColumnWidths concern
|
||||
@@ -99,15 +222,19 @@ All notable changes to this project will be documented in this file.
|
||||
- Config setting to configure cell caching
|
||||
|
||||
### Changed
|
||||
|
||||
- Sheet titles longer than 31 chars get trimmed.
|
||||
- Sheet titles with unsupported chars get cleaned.
|
||||
|
||||
### Fixed
|
||||
- Fixed issue with using ShouldAutosize in combination with FromView column widths.
|
||||
|
||||
- Fixed issue with using ShouldAutosize in combination with FromView column
|
||||
widths.
|
||||
|
||||
## [3.1.20] - 2020-07-22
|
||||
|
||||
### Added
|
||||
|
||||
- Re-sycing remote temporary file
|
||||
- Remember row number
|
||||
- Remember chunk offset
|
||||
@@ -116,6 +243,7 @@ All notable changes to this project will be documented in this file.
|
||||
- Publishing the stubs
|
||||
|
||||
### Changed
|
||||
|
||||
- Interacting with queued jobs
|
||||
- Retry until and middleware on queued imports
|
||||
- Using WithValidation with FromCollection & FromArray
|
||||
@@ -123,16 +251,28 @@ All notable changes to this project will be documented in this file.
|
||||
- Bump of minimum version PhpSpreadsheet
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed test helper docblocks on the Excel facade.
|
||||
- Fix for importing with a start row beyond the highest row.
|
||||
- Fixed `BeforeSheet` and `AfterSheet` events receiving exportable instance instead of importable when calling on an Import.
|
||||
- Fixed `BeforeSheet` and `AfterSheet` events receiving exportable instance
|
||||
instead of importable when calling on an Import.
|
||||
- Fix for value binders not working in queued exports.
|
||||
- Fix when using WithLimit concern when having less rows than the limit.
|
||||
- Fix AfterImport job being fired twice if not using queueing.
|
||||
- Raw() method now also available on Exportable.
|
||||
- Fix for breaking changes in PhpSpreadsheet with empty enclosures.
|
||||
|
||||
[Unreleased]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.30...HEAD
|
||||
[Unreleased]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.40...HEAD
|
||||
[3.1.40]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.39...3.1.40
|
||||
[3.1.39]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.38...3.1.39
|
||||
[3.1.38]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.37...3.1.38
|
||||
[3.1.37]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.36...3.1.37
|
||||
[3.1.36]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.35...3.1.36
|
||||
[3.1.35]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.34...3.1.35
|
||||
[3.1.34]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.33...3.1.34
|
||||
[3.1.33]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.32...3.1.33
|
||||
[3.1.32]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.31...3.1.32
|
||||
[3.1.31]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.30...3.1.31
|
||||
[3.1.30]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.29...3.1.30
|
||||
[3.1.29]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.28...3.1.29
|
||||
[3.1.28]: https://github.com/Maatwebsite/Laravel-Excel/compare/3.1.27...3.1.28
|
||||
|
4
vendor/maatwebsite/excel/CODE_OF_CONDUCT.md
vendored
4
vendor/maatwebsite/excel/CODE_OF_CONDUCT.md
vendored
@@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at patrick@maatwebsite.nl. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at patrick@spartner.nl. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
@@ -43,4 +43,4 @@ Project maintainers who do not follow or enforce the Code of Conduct in good fai
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
|
4
vendor/maatwebsite/excel/LICENSE
vendored
4
vendor/maatwebsite/excel/LICENSE
vendored
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Maatwebsite
|
||||
Copyright (c) Spartner
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
SOFTWARE.
|
||||
|
34
vendor/maatwebsite/excel/README.md
vendored
34
vendor/maatwebsite/excel/README.md
vendored
@@ -1,6 +1,11 @@
|
||||
<br />
|
||||
<br />
|
||||
<p align="center">
|
||||
<img src="https://user-images.githubusercontent.com/7728097/67977317-26178100-fc18-11e9-943e-c5302ca32622.png" width="400" height="82" alt="Laravel Excel logo">
|
||||
<!-- XMAS: https://user-images.githubusercontent.com/7728097/146406114-a5f5e13a-e2ee-47a2-9bf9-ad43cdbdf200.png-->
|
||||
<img width="589" src="https://user-images.githubusercontent.com/7728097/143205384-af3c73a8-0253-45f3-b5ac-28a335dddb87.png" alt="Laravel Excel logo">
|
||||
</p>
|
||||
<br />
|
||||
|
||||
|
||||
<h3 align="center">Supercharged Excel exports and imports</h3>
|
||||
|
||||
@@ -16,7 +21,7 @@ exports and imports.
|
||||
<span> · </span>
|
||||
<a href="https://course.laravel-excel.com">Video Course</a>
|
||||
<span> · </span>
|
||||
<a href="https://github.com/Maatwebsite/Laravel-Nova-Excel">Nova</a>
|
||||
<a href="https://github.com/SpartnerNL/Laravel-Nova-Excel">Nova</a>
|
||||
<span> · </span>
|
||||
<a href="https://medium.com/maatwebsite/laravel-excel/home">Blog</a>
|
||||
<span> · </span>
|
||||
@@ -26,7 +31,7 @@ exports and imports.
|
||||
</h4>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/Maatwebsite/Laravel-Excel/actions">
|
||||
<a href="https://github.com/SpartnerNL/Laravel-Excel/actions">
|
||||
<img src="https://github.com/Maatwebsite/Laravel-Excel/workflows/Run%20tests/badge.svg?branch=3.1" alt="Github Actions">
|
||||
</a>
|
||||
|
||||
@@ -64,31 +69,30 @@ exports and imports.
|
||||
|
||||
You can find the full documentation of Laravel Excel [on the website](https://docs.laravel-excel.com).
|
||||
|
||||
We welcome suggestions for improving our docs. The documentation repository can be found at [https://github.com/Maatwebsite/laravel-excel-docs](https://github.com/Maatwebsite/laravel-excel-docs).
|
||||
We welcome suggestions for improving our docs. The documentation repository can be found at [https://github.com/SpartnerNL/laravel-excel-docs](https://github.com/SpartnerNL/laravel-excel-docs).
|
||||
|
||||
Some articles and tutorials can be found on our blog: https://medium.com/maatwebsite/laravel-excel/home
|
||||
|
||||
## 🎥 Video Course
|
||||
|
||||
We are currently building a video course called "Advanced Laravel Excel". In this video course we’ll build a small application with real-life, complex imports and exports that go beyond simple user imports and exports. We’ll go step-by-step and tackle implementing Laravel Excel in a performant way.
|
||||
|
||||
If you sign up now, you’ll get notified when the course launches and get it for the early bird price of $69 instead of ~~$99~~.
|
||||
|
||||
https://course.laravel-excel.com
|
||||
|
||||
## :mailbox_with_mail: License & Postcardware
|
||||
|
||||

|
||||
|
||||
Laravel Excel is completely free (MIT license) to use, however the package is licensed as Postcardware. This means that if it makes it to your production environment, we would very much appreciate receiving a postcard from your hometown.
|
||||
Laravel Excel is created with love and care by Spartner (formerly known as Maatwebsite) to give back to the Laravel community. It is completely free (MIT license) to use, however the package is licensed as Postcardware. This means that if it makes it to your production environment, we would very much appreciate receiving a postcard from your hometown.
|
||||
|
||||
**Maatwebsite**
|
||||
**Spartner**
|
||||
Markt 2
|
||||
6231 LS Meerssen
|
||||
The Netherlands
|
||||
The Netherlands.
|
||||
|
||||
More about the license can be found at: [https://docs.laravel-excel.com/3.1/getting-started/license.html](https://docs.laravel-excel.com/3.1/getting-started/license.html)
|
||||
|
||||
## Created by Spartner (formerly Maatwebsite)
|
||||
|
||||
We are a strategic development partner, creating web-based custom built software from Laravel. In need of a digital solution for your challenge? Give us a call.
|
||||
|
||||
https://spartner.software
|
||||
info@spartner.nl
|
||||
+31 (0) 10 - 7449312
|
||||
|
||||
## :wrench: Supported Versions
|
||||
|
||||
|
2
vendor/maatwebsite/excel/SECURITY.md
vendored
2
vendor/maatwebsite/excel/SECURITY.md
vendored
@@ -12,4 +12,4 @@ Version | Security Fixes Until
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you discover a security vulnerability within Laravel Excel, please send an email to Patrick Brouwers at patrick@maatwebsite.nl. All security vulnerabilities will be promptly addressed.
|
||||
If you discover a security vulnerability within Laravel Excel, please send an email to Patrick Brouwers at patrick@spartner.nl. All security vulnerabilities will be promptly addressed.
|
||||
|
10
vendor/maatwebsite/excel/composer.json
vendored
10
vendor/maatwebsite/excel/composer.json
vendored
@@ -16,17 +16,19 @@
|
||||
"authors": [
|
||||
{
|
||||
"name": "Patrick Brouwers",
|
||||
"email": "patrick@maatwebsite.nl"
|
||||
"email": "patrick@spartner.nl"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"php": "^7.0|^8.0",
|
||||
"phpoffice/phpspreadsheet": "1.16.*",
|
||||
"illuminate/support": "5.8.*|^6.0|^7.0|^8.0"
|
||||
"phpoffice/phpspreadsheet": "^1.18",
|
||||
"illuminate/support": "5.8.*|^6.0|^7.0|^8.0|^9.0",
|
||||
"psr/simple-cache": "^1.0|^2.0|^3.0",
|
||||
"composer/semver": "^3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"orchestra/testbench": "^6.0",
|
||||
"orchestra/testbench": "^6.0|^7.0",
|
||||
"predis/predis": "^1.1"
|
||||
},
|
||||
"autoload": {
|
||||
|
11
vendor/maatwebsite/excel/config/excel.php
vendored
11
vendor/maatwebsite/excel/config/excel.php
vendored
@@ -48,6 +48,8 @@ return [
|
||||
'use_bom' => false,
|
||||
'include_separator_line' => false,
|
||||
'excel_compatibility' => false,
|
||||
'output_encoding' => '',
|
||||
'test_auto_detect' => true,
|
||||
],
|
||||
|
||||
/*
|
||||
@@ -121,7 +123,7 @@ return [
|
||||
|
|
||||
*/
|
||||
'csv' => [
|
||||
'delimiter' => ',',
|
||||
'delimiter' => null,
|
||||
'enclosure' => '"',
|
||||
'escape_character' => '\\',
|
||||
'contiguous' => false,
|
||||
@@ -218,7 +220,7 @@ return [
|
||||
| By default PhpSpreadsheet keeps all cell values in memory, however when
|
||||
| dealing with large files, this might result into memory issues. If you
|
||||
| want to mitigate that, you can configure a cell caching driver here.
|
||||
| When using the illuminate driver, it will store each value in a the
|
||||
| When using the illuminate driver, it will store each value in the
|
||||
| cache store. This can slow down the process, because it needs to
|
||||
| store each value. You can use the "batch" store if you want to
|
||||
| only persist to the store when the memory limit is reached.
|
||||
@@ -276,6 +278,9 @@ return [
|
||||
*/
|
||||
'transactions' => [
|
||||
'handler' => 'db',
|
||||
'db' => [
|
||||
'connection' => null,
|
||||
],
|
||||
],
|
||||
|
||||
'temporary_files' => [
|
||||
@@ -289,7 +294,7 @@ return [
|
||||
| storing reading or downloading. Here you can customize that path.
|
||||
|
|
||||
*/
|
||||
'local_path' => storage_path('framework/laravel-excel'),
|
||||
'local_path' => storage_path('framework/cache/laravel-excel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@@ -17,8 +17,8 @@ class BatchCache implements CacheInterface
|
||||
protected $memory;
|
||||
|
||||
/**
|
||||
* @param CacheInterface $cache
|
||||
* @param MemoryCache $memory
|
||||
* @param CacheInterface $cache
|
||||
* @param MemoryCache $memory
|
||||
*/
|
||||
public function __construct(CacheInterface $cache, MemoryCache $memory)
|
||||
{
|
||||
@@ -29,7 +29,7 @@ class BatchCache implements CacheInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
public function get(string $key, mixed $default = null): mixed
|
||||
{
|
||||
if ($this->memory->has($key)) {
|
||||
return $this->memory->get($key);
|
||||
@@ -41,7 +41,7 @@ class BatchCache implements CacheInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($key, $value, $ttl = null)
|
||||
public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool
|
||||
{
|
||||
$this->memory->set($key, $value, $ttl);
|
||||
|
||||
@@ -55,7 +55,7 @@ class BatchCache implements CacheInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($key)
|
||||
public function delete(string $key): bool
|
||||
{
|
||||
if ($this->memory->has($key)) {
|
||||
return $this->memory->delete($key);
|
||||
@@ -67,7 +67,7 @@ class BatchCache implements CacheInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function clear()
|
||||
public function clear(): bool
|
||||
{
|
||||
$this->memory->clear();
|
||||
|
||||
@@ -77,7 +77,7 @@ class BatchCache implements CacheInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMultiple($keys, $default = null)
|
||||
public function getMultiple(iterable $keys, mixed $default = null): iterable
|
||||
{
|
||||
// Check if all keys are still in memory
|
||||
$memory = $this->memory->getMultiple($keys, $default);
|
||||
@@ -105,7 +105,7 @@ class BatchCache implements CacheInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setMultiple($values, $ttl = null)
|
||||
public function setMultiple(iterable $values, null|int|\DateInterval $ttl = null): bool
|
||||
{
|
||||
$this->memory->setMultiple($values, $ttl);
|
||||
|
||||
@@ -119,7 +119,7 @@ class BatchCache implements CacheInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteMultiple($keys)
|
||||
public function deleteMultiple(iterable $keys): bool
|
||||
{
|
||||
$keys = is_array($keys) ? $keys : iterator_to_array($keys);
|
||||
|
||||
@@ -131,7 +131,7 @@ class BatchCache implements CacheInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function has($key)
|
||||
public function has(string $key): bool
|
||||
{
|
||||
if ($this->memory->has($key)) {
|
||||
return true;
|
||||
|
142
vendor/maatwebsite/excel/src/Cache/BatchCacheDeprecated.php
vendored
Normal file
142
vendor/maatwebsite/excel/src/Cache/BatchCacheDeprecated.php
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Cache;
|
||||
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
|
||||
class BatchCacheDeprecated implements CacheInterface
|
||||
{
|
||||
/**
|
||||
* @var CacheInterface
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* @var MemoryCacheDeprecated
|
||||
*/
|
||||
protected $memory;
|
||||
|
||||
/**
|
||||
* @param CacheInterface $cache
|
||||
* @param MemoryCacheDeprecated $memory
|
||||
*/
|
||||
public function __construct(CacheInterface $cache, MemoryCacheDeprecated $memory)
|
||||
{
|
||||
$this->cache = $cache;
|
||||
$this->memory = $memory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
if ($this->memory->has($key)) {
|
||||
return $this->memory->get($key);
|
||||
}
|
||||
|
||||
return $this->cache->get($key, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($key, $value, $ttl = null)
|
||||
{
|
||||
$this->memory->set($key, $value, $ttl);
|
||||
|
||||
if ($this->memory->reachedMemoryLimit()) {
|
||||
return $this->cache->setMultiple($this->memory->flush(), $ttl);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($key)
|
||||
{
|
||||
if ($this->memory->has($key)) {
|
||||
return $this->memory->delete($key);
|
||||
}
|
||||
|
||||
return $this->cache->delete($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->memory->clear();
|
||||
|
||||
return $this->cache->clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMultiple($keys, $default = null)
|
||||
{
|
||||
// Check if all keys are still in memory
|
||||
$memory = $this->memory->getMultiple($keys, $default);
|
||||
$actualItemsInMemory = count(array_filter($memory));
|
||||
|
||||
if ($actualItemsInMemory === count($keys)) {
|
||||
return $memory;
|
||||
}
|
||||
|
||||
// Get all rows from cache if none is hold in memory.
|
||||
if ($actualItemsInMemory === 0) {
|
||||
return $this->cache->getMultiple($keys, $default);
|
||||
}
|
||||
|
||||
// Add missing values from cache.
|
||||
foreach ($this->cache->getMultiple($keys, $default) as $key => $value) {
|
||||
if (null !== $value) {
|
||||
$memory[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $memory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setMultiple($values, $ttl = null)
|
||||
{
|
||||
$this->memory->setMultiple($values, $ttl);
|
||||
|
||||
if ($this->memory->reachedMemoryLimit()) {
|
||||
return $this->cache->setMultiple($this->memory->flush(), $ttl);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteMultiple($keys)
|
||||
{
|
||||
$keys = is_array($keys) ? $keys : iterator_to_array($keys);
|
||||
|
||||
$this->memory->deleteMultiple($keys);
|
||||
|
||||
return $this->cache->deleteMultiple($keys);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function has($key)
|
||||
{
|
||||
if ($this->memory->has($key)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->cache->has($key);
|
||||
}
|
||||
}
|
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Maatwebsite\Excel\Cache;
|
||||
|
||||
use Composer\InstalledVersions;
|
||||
use Composer\Semver\VersionParser;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Manager;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
@@ -38,6 +40,12 @@ class CacheManager extends Manager
|
||||
*/
|
||||
public function createMemoryDriver(): CacheInterface
|
||||
{
|
||||
if (!InstalledVersions::satisfies(new VersionParser, 'psr/simple-cache', '^3.0')) {
|
||||
return new MemoryCacheDeprecated(
|
||||
config('excel.cache.batch.memory_limit', 60000)
|
||||
);
|
||||
}
|
||||
|
||||
return new MemoryCache(
|
||||
config('excel.cache.batch.memory_limit', 60000)
|
||||
);
|
||||
@@ -48,6 +56,13 @@ class CacheManager extends Manager
|
||||
*/
|
||||
public function createBatchDriver(): CacheInterface
|
||||
{
|
||||
if (!InstalledVersions::satisfies(new VersionParser, 'psr/simple-cache', '^3.0')) {
|
||||
return new BatchCacheDeprecated(
|
||||
$this->createIlluminateDriver(),
|
||||
$this->createMemoryDriver()
|
||||
);
|
||||
}
|
||||
|
||||
return new BatchCache(
|
||||
$this->createIlluminateDriver(),
|
||||
$this->createMemoryDriver()
|
||||
|
@@ -17,7 +17,7 @@ class MemoryCache implements CacheInterface
|
||||
protected $cache = [];
|
||||
|
||||
/**
|
||||
* @param int|null $memoryLimit
|
||||
* @param int|null $memoryLimit
|
||||
*/
|
||||
public function __construct(int $memoryLimit = null)
|
||||
{
|
||||
@@ -27,7 +27,7 @@ class MemoryCache implements CacheInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function clear()
|
||||
public function clear(): bool
|
||||
{
|
||||
$this->cache = [];
|
||||
|
||||
@@ -37,7 +37,7 @@ class MemoryCache implements CacheInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($key)
|
||||
public function delete(string $key): bool
|
||||
{
|
||||
unset($this->cache[$key]);
|
||||
|
||||
@@ -47,7 +47,7 @@ class MemoryCache implements CacheInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteMultiple($keys)
|
||||
public function deleteMultiple($keys): bool
|
||||
{
|
||||
foreach ($keys as $key) {
|
||||
$this->delete($key);
|
||||
@@ -59,7 +59,7 @@ class MemoryCache implements CacheInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
public function get(string $key, mixed $default = null): mixed
|
||||
{
|
||||
if ($this->has($key)) {
|
||||
return $this->cache[$key];
|
||||
@@ -71,7 +71,7 @@ class MemoryCache implements CacheInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMultiple($keys, $default = null)
|
||||
public function getMultiple(iterable $keys, mixed $default = null): iterable
|
||||
{
|
||||
$results = [];
|
||||
foreach ($keys as $key) {
|
||||
@@ -84,7 +84,7 @@ class MemoryCache implements CacheInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function has($key)
|
||||
public function has($key): bool
|
||||
{
|
||||
return isset($this->cache[$key]);
|
||||
}
|
||||
@@ -92,7 +92,7 @@ class MemoryCache implements CacheInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($key, $value, $ttl = null)
|
||||
public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool
|
||||
{
|
||||
$this->cache[$key] = $value;
|
||||
|
||||
@@ -102,7 +102,7 @@ class MemoryCache implements CacheInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setMultiple($values, $ttl = null)
|
||||
public function setMultiple($values, $ttl = null): bool
|
||||
{
|
||||
foreach ($values as $key => $value) {
|
||||
$this->set($key, $value);
|
||||
|
138
vendor/maatwebsite/excel/src/Cache/MemoryCacheDeprecated.php
vendored
Normal file
138
vendor/maatwebsite/excel/src/Cache/MemoryCacheDeprecated.php
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Cache;
|
||||
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
|
||||
class MemoryCacheDeprecated implements CacheInterface
|
||||
{
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
protected $memoryLimit;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $cache = [];
|
||||
|
||||
/**
|
||||
* @param int|null $memoryLimit
|
||||
*/
|
||||
public function __construct(int $memoryLimit = null)
|
||||
{
|
||||
$this->memoryLimit = $memoryLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->cache = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($key)
|
||||
{
|
||||
unset($this->cache[$key]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteMultiple($keys)
|
||||
{
|
||||
foreach ($keys as $key) {
|
||||
$this->delete($key);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
if ($this->has($key)) {
|
||||
return $this->cache[$key];
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMultiple($keys, $default = null)
|
||||
{
|
||||
$results = [];
|
||||
foreach ($keys as $key) {
|
||||
$results[$key] = $this->get($key, $default);
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function has($key)
|
||||
{
|
||||
return isset($this->cache[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($key, $value, $ttl = null)
|
||||
{
|
||||
$this->cache[$key] = $value;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setMultiple($values, $ttl = null)
|
||||
{
|
||||
foreach ($values as $key => $value) {
|
||||
$this->set($key, $value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function reachedMemoryLimit(): bool
|
||||
{
|
||||
// When no limit is given, we'll never reach any limit.
|
||||
if (null === $this->memoryLimit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return count($this->cache) >= $this->memoryLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function flush(): array
|
||||
{
|
||||
$memory = $this->cache;
|
||||
|
||||
$this->clear();
|
||||
|
||||
return $memory;
|
||||
}
|
||||
}
|
16
vendor/maatwebsite/excel/src/Cell.php
vendored
16
vendor/maatwebsite/excel/src/Cell.php
vendored
@@ -8,6 +8,7 @@ use PhpOffice\PhpSpreadsheet\RichText\RichText;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
|
||||
/** @mixin SpreadsheetCell */
|
||||
class Cell
|
||||
{
|
||||
use DelegatedMacroable;
|
||||
@@ -18,7 +19,7 @@ class Cell
|
||||
private $cell;
|
||||
|
||||
/**
|
||||
* @param SpreadsheetCell $cell
|
||||
* @param SpreadsheetCell $cell
|
||||
*/
|
||||
public function __construct(SpreadsheetCell $cell)
|
||||
{
|
||||
@@ -26,11 +27,11 @@ class Cell
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Worksheet $worksheet
|
||||
* @param string $coordinate
|
||||
* @param Worksheet $worksheet
|
||||
* @param string $coordinate
|
||||
* @return Cell
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
* @return Cell
|
||||
*/
|
||||
public static function make(Worksheet $worksheet, string $coordinate)
|
||||
{
|
||||
@@ -46,10 +47,9 @@ class Cell
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $nullValue
|
||||
* @param bool $calculateFormulas
|
||||
* @param bool $formatData
|
||||
*
|
||||
* @param null $nullValue
|
||||
* @param bool $calculateFormulas
|
||||
* @param bool $formatData
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValue($nullValue = null, $calculateFormulas = false, $formatData = true)
|
||||
|
7
vendor/maatwebsite/excel/src/ChunkReader.php
vendored
7
vendor/maatwebsite/excel/src/ChunkReader.php
vendored
@@ -21,10 +21,9 @@ use Throwable;
|
||||
class ChunkReader
|
||||
{
|
||||
/**
|
||||
* @param WithChunkReading $import
|
||||
* @param Reader $reader
|
||||
* @param TemporaryFile $temporaryFile
|
||||
*
|
||||
* @param WithChunkReading $import
|
||||
* @param Reader $reader
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @return \Illuminate\Foundation\Bus\PendingDispatch|null
|
||||
*/
|
||||
public function read(WithChunkReading $import, Reader $reader, TemporaryFile $temporaryFile)
|
||||
|
@@ -10,12 +10,12 @@ use Maatwebsite\Excel\Exporter;
|
||||
trait Exportable
|
||||
{
|
||||
/**
|
||||
* @param string $fileName
|
||||
* @param string|null $writerType
|
||||
* @param array $headers
|
||||
* @param string $fileName
|
||||
* @param string|null $writerType
|
||||
* @param array $headers
|
||||
* @return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\BinaryFileResponse
|
||||
*
|
||||
* @throws NoFilenameGivenException
|
||||
* @return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\BinaryFileResponse
|
||||
*/
|
||||
public function download(string $fileName = null, string $writerType = null, array $headers = null)
|
||||
{
|
||||
@@ -31,13 +31,13 @@ trait Exportable
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $writerType
|
||||
* @param mixed $diskOptions
|
||||
* @param string $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $writerType
|
||||
* @param mixed $diskOptions
|
||||
* @return bool|PendingDispatch
|
||||
*
|
||||
* @throws NoFilePathGivenException
|
||||
* @return bool|PendingDispatch
|
||||
*/
|
||||
public function store(string $filePath = null, string $disk = null, string $writerType = null, $diskOptions = [])
|
||||
{
|
||||
@@ -52,18 +52,18 @@ trait Exportable
|
||||
$filePath,
|
||||
$disk ?? $this->disk ?? null,
|
||||
$writerType ?? $this->writerType ?? null,
|
||||
$diskOptions ?? $this->diskOptions ?? []
|
||||
$diskOptions ?: $this->diskOptions ?? []
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $writerType
|
||||
* @param mixed $diskOptions
|
||||
* @param string|null $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $writerType
|
||||
* @param mixed $diskOptions
|
||||
* @return PendingDispatch
|
||||
*
|
||||
* @throws NoFilePathGivenException
|
||||
* @return PendingDispatch
|
||||
*/
|
||||
public function queue(string $filePath = null, string $disk = null, string $writerType = null, $diskOptions = [])
|
||||
{
|
||||
@@ -78,13 +78,12 @@ trait Exportable
|
||||
$filePath,
|
||||
$disk ?? $this->disk ?? null,
|
||||
$writerType ?? $this->writerType ?? null,
|
||||
$diskOptions ?? $this->diskOptions ?? []
|
||||
$diskOptions ?: $this->diskOptions ?? []
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $writerType
|
||||
*
|
||||
* @param string|null $writerType
|
||||
* @return string
|
||||
*/
|
||||
public function raw($writerType = null)
|
||||
@@ -97,10 +96,10 @@ trait Exportable
|
||||
/**
|
||||
* Create an HTTP response that represents the object.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws NoFilenameGivenException
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function toResponse($request)
|
||||
{
|
||||
|
@@ -2,12 +2,14 @@
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
|
||||
interface FromQuery
|
||||
{
|
||||
/**
|
||||
* @return Builder
|
||||
* @return Builder|EloquentBuilder|Relation
|
||||
*/
|
||||
public function query();
|
||||
}
|
||||
|
@@ -21,12 +21,12 @@ trait Importable
|
||||
protected $output;
|
||||
|
||||
/**
|
||||
* @param string|UploadedFile|null $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @param string|UploadedFile|null $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @return Importer|PendingDispatch
|
||||
*
|
||||
* @throws NoFilePathGivenException
|
||||
* @return Importer|PendingDispatch
|
||||
*/
|
||||
public function import($filePath = null, string $disk = null, string $readerType = null)
|
||||
{
|
||||
@@ -41,12 +41,12 @@ trait Importable
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|UploadedFile|null $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @param string|UploadedFile|null $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @return array
|
||||
*
|
||||
* @throws NoFilePathGivenException
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($filePath = null, string $disk = null, string $readerType = null): array
|
||||
{
|
||||
@@ -61,12 +61,12 @@ trait Importable
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|UploadedFile|null $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @param string|UploadedFile|null $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @return Collection
|
||||
*
|
||||
* @throws NoFilePathGivenException
|
||||
* @return Collection
|
||||
*/
|
||||
public function toCollection($filePath = null, string $disk = null, string $readerType = null): Collection
|
||||
{
|
||||
@@ -81,13 +81,13 @@ trait Importable
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|UploadedFile|null $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @param string|UploadedFile|null $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @return PendingDispatch
|
||||
*
|
||||
* @throws NoFilePathGivenException
|
||||
* @throws InvalidArgumentException
|
||||
* @return PendingDispatch
|
||||
*/
|
||||
public function queue($filePath = null, string $disk = null, string $readerType = null)
|
||||
{
|
||||
@@ -99,8 +99,7 @@ trait Importable
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OutputStyle $output
|
||||
*
|
||||
* @param OutputStyle $output
|
||||
* @return $this
|
||||
*/
|
||||
public function withOutput(OutputStyle $output)
|
||||
@@ -123,10 +122,10 @@ trait Importable
|
||||
}
|
||||
|
||||
/**
|
||||
* @param UploadedFile|string|null $filePath
|
||||
* @param UploadedFile|string|null $filePath
|
||||
* @return UploadedFile|string
|
||||
*
|
||||
* @throws NoFilePathGivenException
|
||||
* @return UploadedFile|string
|
||||
*/
|
||||
private function getFilePath($filePath = null)
|
||||
{
|
||||
|
@@ -52,7 +52,17 @@ trait MapsCsvSettings
|
||||
protected static $inputEncoding = 'UTF-8';
|
||||
|
||||
/**
|
||||
* @param array $config
|
||||
* @var string
|
||||
*/
|
||||
protected static $outputEncoding = '';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected static $testAutoDetect = true;
|
||||
|
||||
/**
|
||||
* @param array $config
|
||||
*/
|
||||
public static function applyCsvSettings(array $config)
|
||||
{
|
||||
@@ -65,5 +75,7 @@ trait MapsCsvSettings
|
||||
static::$escapeCharacter = Arr::get($config, 'escape_character', static::$escapeCharacter);
|
||||
static::$contiguous = Arr::get($config, 'contiguous', static::$contiguous);
|
||||
static::$inputEncoding = Arr::get($config, 'input_encoding', static::$inputEncoding);
|
||||
static::$outputEncoding = Arr::get($config, 'output_encoding', static::$outputEncoding);
|
||||
static::$testAutoDetect = Arr::get($config, 'test_auto_detect', static::$testAutoDetect);
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ use Maatwebsite\Excel\Row;
|
||||
interface OnEachRow
|
||||
{
|
||||
/**
|
||||
* @param Row $row
|
||||
* @param Row $row
|
||||
*/
|
||||
public function onRow(Row $row);
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ trait RemembersChunkOffset
|
||||
protected $chunkOffset;
|
||||
|
||||
/**
|
||||
* @param int $chunkOffset
|
||||
* @param int $chunkOffset
|
||||
*/
|
||||
public function setChunkOffset(int $chunkOffset)
|
||||
{
|
||||
|
@@ -10,7 +10,7 @@ trait RemembersRowNumber
|
||||
protected $rowNumber;
|
||||
|
||||
/**
|
||||
* @param int $rowNumber
|
||||
* @param int $rowNumber
|
||||
*/
|
||||
public function rememberRowNumber(int $rowNumber)
|
||||
{
|
||||
|
@@ -13,7 +13,7 @@ trait SkipsErrors
|
||||
protected $errors = [];
|
||||
|
||||
/**
|
||||
* @param Throwable $e
|
||||
* @param Throwable $e
|
||||
*/
|
||||
public function onError(Throwable $e)
|
||||
{
|
||||
|
@@ -13,7 +13,7 @@ trait SkipsFailures
|
||||
protected $failures = [];
|
||||
|
||||
/**
|
||||
* @param Failure ...$failures
|
||||
* @param Failure ...$failures
|
||||
*/
|
||||
public function onFailure(Failure ...$failures)
|
||||
{
|
||||
|
@@ -7,7 +7,7 @@ use Throwable;
|
||||
interface SkipsOnError
|
||||
{
|
||||
/**
|
||||
* @param Throwable $e
|
||||
* @param Throwable $e
|
||||
*/
|
||||
public function onError(Throwable $e);
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ use Maatwebsite\Excel\Validators\Failure;
|
||||
interface SkipsOnFailure
|
||||
{
|
||||
/**
|
||||
* @param Failure[] $failures
|
||||
* @param Failure[] $failures
|
||||
*/
|
||||
public function onFailure(Failure ...$failures);
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ namespace Maatwebsite\Excel\Concerns;
|
||||
interface SkipsUnknownSheets
|
||||
{
|
||||
/**
|
||||
* @param string|int $sheetName
|
||||
* @param string|int $sheetName
|
||||
*/
|
||||
public function onUnknownSheet($sheetName);
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ namespace Maatwebsite\Excel\Concerns;
|
||||
interface ToArray
|
||||
{
|
||||
/**
|
||||
* @param array $array
|
||||
* @param array $array
|
||||
*/
|
||||
public function array(array $array);
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ use Illuminate\Support\Collection;
|
||||
interface ToCollection
|
||||
{
|
||||
/**
|
||||
* @param Collection $collection
|
||||
* @param Collection $collection
|
||||
*/
|
||||
public function collection(Collection $collection);
|
||||
}
|
||||
|
@@ -7,8 +7,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
interface ToModel
|
||||
{
|
||||
/**
|
||||
* @param array $row
|
||||
*
|
||||
* @param array $row
|
||||
* @return Model|Model[]|null
|
||||
*/
|
||||
public function model(array $row);
|
||||
|
13
vendor/maatwebsite/excel/src/Concerns/WithBackgroundColor.php
vendored
Normal file
13
vendor/maatwebsite/excel/src/Concerns/WithBackgroundColor.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Style\Color;
|
||||
|
||||
interface WithBackgroundColor
|
||||
{
|
||||
/**
|
||||
* @return string|array|Color
|
||||
*/
|
||||
public function backgroundColor();
|
||||
}
|
@@ -10,8 +10,7 @@ trait WithConditionalSheets
|
||||
protected $conditionallySelectedSheets = [];
|
||||
|
||||
/**
|
||||
* @param string|array $sheets
|
||||
*
|
||||
* @param string|array $sheets
|
||||
* @return $this
|
||||
*/
|
||||
public function onlySheets($sheets)
|
||||
|
13
vendor/maatwebsite/excel/src/Concerns/WithDefaultStyles.php
vendored
Normal file
13
vendor/maatwebsite/excel/src/Concerns/WithDefaultStyles.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Style\Style;
|
||||
|
||||
interface WithDefaultStyles
|
||||
{
|
||||
/**
|
||||
* @return array|void
|
||||
*/
|
||||
public function defaultStyles(Style $defaultStyle);
|
||||
}
|
7
vendor/maatwebsite/excel/src/Concerns/WithGroupedHeadingRow.php
vendored
Normal file
7
vendor/maatwebsite/excel/src/Concerns/WithGroupedHeadingRow.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Maatwebsite\Excel\Concerns;
|
||||
|
||||
interface WithGroupedHeadingRow extends WithHeadingRow
|
||||
{
|
||||
}
|
@@ -5,8 +5,7 @@ namespace Maatwebsite\Excel\Concerns;
|
||||
interface WithMapping
|
||||
{
|
||||
/**
|
||||
* @param mixed $row
|
||||
*
|
||||
* @param mixed $row
|
||||
* @return array
|
||||
*/
|
||||
public function map($row): array;
|
||||
|
@@ -51,8 +51,7 @@ class ExportMakeCommand extends GeneratorCommand
|
||||
/**
|
||||
* Get the default namespace for the class.
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
* @return string
|
||||
*/
|
||||
protected function getDefaultNamespace($rootNamespace)
|
||||
@@ -64,8 +63,7 @@ class ExportMakeCommand extends GeneratorCommand
|
||||
* Build the class with the given name.
|
||||
* Remove the base controller import if we are already in base namespace.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
protected function buildClass($name)
|
||||
|
@@ -45,8 +45,7 @@ class ImportMakeCommand extends GeneratorCommand
|
||||
/**
|
||||
* Get the default namespace for the class.
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
* @return string
|
||||
*/
|
||||
protected function getDefaultNamespace($rootNamespace)
|
||||
@@ -58,8 +57,7 @@ class ImportMakeCommand extends GeneratorCommand
|
||||
* Build the class with the given name.
|
||||
* Remove the base controller import if we are already in base namespace.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
protected function buildClass($name)
|
||||
|
@@ -10,8 +10,7 @@ trait WithModelStub
|
||||
/**
|
||||
* Build the model replacement values.
|
||||
*
|
||||
* @param array $replace
|
||||
*
|
||||
* @param array $replace
|
||||
* @return array
|
||||
*/
|
||||
protected function buildModelReplacements(array $replace): array
|
||||
@@ -27,8 +26,7 @@ trait WithModelStub
|
||||
/**
|
||||
* Get the fully-qualified model class name.
|
||||
*
|
||||
* @param string $model
|
||||
*
|
||||
* @param string $model
|
||||
* @return string
|
||||
*/
|
||||
protected function parseModel($model): string
|
||||
@@ -37,12 +35,20 @@ trait WithModelStub
|
||||
throw new InvalidArgumentException('Model name contains invalid characters.');
|
||||
}
|
||||
|
||||
$model = trim(str_replace('/', '\\', $model), '\\');
|
||||
$model = ltrim($model, '\\/');
|
||||
|
||||
if (!Str::startsWith($model, $rootNamespace = $this->laravel->getNamespace())) {
|
||||
$model = $rootNamespace . $model;
|
||||
$model = str_replace('/', '\\', $model);
|
||||
|
||||
$rootNamespace = $this->rootNamespace();
|
||||
|
||||
if (Str::startsWith($model, $rootNamespace)) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
$model = is_dir(app_path('Models'))
|
||||
? $rootNamespace . 'Models\\' . $model
|
||||
: $rootNamespace . $model;
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
|
@@ -8,9 +8,8 @@ use PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder as PhpSpreadsheetDefaultVal
|
||||
class DefaultValueBinder extends PhpSpreadsheetDefaultValueBinder
|
||||
{
|
||||
/**
|
||||
* @param Cell $cell Cell to bind value to
|
||||
* @param mixed $value Value to bind in cell
|
||||
*
|
||||
* @param Cell $cell Cell to bind value to
|
||||
* @param mixed $value Value to bind in cell
|
||||
* @return bool
|
||||
*/
|
||||
public function bindValue(Cell $cell, $value)
|
||||
|
@@ -13,9 +13,8 @@ trait DelegatedMacroable
|
||||
/**
|
||||
* Dynamically handle calls to the class.
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
|
@@ -17,8 +17,8 @@ class AfterImport extends Event
|
||||
private $importable;
|
||||
|
||||
/**
|
||||
* @param Reader $reader
|
||||
* @param object $importable
|
||||
* @param Reader $reader
|
||||
* @param object $importable
|
||||
*/
|
||||
public function __construct(Reader $reader, $importable)
|
||||
{
|
||||
|
@@ -17,8 +17,8 @@ class AfterSheet extends Event
|
||||
private $exportable;
|
||||
|
||||
/**
|
||||
* @param Sheet $sheet
|
||||
* @param object $exportable
|
||||
* @param Sheet $sheet
|
||||
* @param object $exportable
|
||||
*/
|
||||
public function __construct(Sheet $sheet, $exportable)
|
||||
{
|
||||
|
@@ -17,8 +17,8 @@ class BeforeExport extends Event
|
||||
private $exportable;
|
||||
|
||||
/**
|
||||
* @param Writer $writer
|
||||
* @param object $exportable
|
||||
* @param Writer $writer
|
||||
* @param object $exportable
|
||||
*/
|
||||
public function __construct(Writer $writer, $exportable)
|
||||
{
|
||||
|
@@ -17,8 +17,8 @@ class BeforeImport extends Event
|
||||
private $importable;
|
||||
|
||||
/**
|
||||
* @param Reader $reader
|
||||
* @param object $importable
|
||||
* @param Reader $reader
|
||||
* @param object $importable
|
||||
*/
|
||||
public function __construct(Reader $reader, $importable)
|
||||
{
|
||||
|
@@ -17,8 +17,8 @@ class BeforeSheet extends Event
|
||||
private $exportable;
|
||||
|
||||
/**
|
||||
* @param Sheet $sheet
|
||||
* @param object $exportable
|
||||
* @param Sheet $sheet
|
||||
* @param object $exportable
|
||||
*/
|
||||
public function __construct(Sheet $sheet, $exportable)
|
||||
{
|
||||
|
@@ -17,8 +17,8 @@ class BeforeWriting extends Event
|
||||
private $exportable;
|
||||
|
||||
/**
|
||||
* @param Writer $writer
|
||||
* @param object $exportable
|
||||
* @param Writer $writer
|
||||
* @param object $exportable
|
||||
*/
|
||||
public function __construct(Writer $writer, $exportable)
|
||||
{
|
||||
|
@@ -15,8 +15,7 @@ abstract class Event
|
||||
abstract public function getDelegate();
|
||||
|
||||
/**
|
||||
* @param string $concern
|
||||
*
|
||||
* @param string $concern
|
||||
* @return bool
|
||||
*/
|
||||
public function appliesToConcern(string $concern): bool
|
||||
|
16
vendor/maatwebsite/excel/src/Excel.php
vendored
16
vendor/maatwebsite/excel/src/Excel.php
vendored
@@ -58,10 +58,10 @@ class Excel implements Exporter, Importer
|
||||
private $reader;
|
||||
|
||||
/**
|
||||
* @param Writer $writer
|
||||
* @param QueuedWriter $queuedWriter
|
||||
* @param Reader $reader
|
||||
* @param Filesystem $filesystem
|
||||
* @param Writer $writer
|
||||
* @param QueuedWriter $queuedWriter
|
||||
* @param Reader $reader
|
||||
* @param Filesystem $filesystem
|
||||
*/
|
||||
public function __construct(
|
||||
Writer $writer,
|
||||
@@ -181,12 +181,12 @@ class Excel implements Exporter, Importer
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $export
|
||||
* @param string|null $fileName
|
||||
* @param string $writerType
|
||||
* @param object $export
|
||||
* @param string|null $fileName
|
||||
* @param string $writerType
|
||||
* @return TemporaryFile
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
* @return TemporaryFile
|
||||
*/
|
||||
protected function export($export, string $fileName, string $writerType = null): TemporaryFile
|
||||
{
|
||||
|
@@ -66,7 +66,7 @@ class ExcelServiceProvider extends ServiceProvider
|
||||
return new CacheManager($app);
|
||||
});
|
||||
|
||||
$this->app->bind(TransactionManager::class, function ($app) {
|
||||
$this->app->singleton(TransactionManager::class, function ($app) {
|
||||
return new TransactionManager($app);
|
||||
});
|
||||
|
||||
|
@@ -8,9 +8,9 @@ use Throwable;
|
||||
class NoFilePathGivenException extends InvalidArgumentException implements LaravelExcelException
|
||||
{
|
||||
/**
|
||||
* @param string $message
|
||||
* @param int $code
|
||||
* @param Throwable|null $previous
|
||||
* @param string $message
|
||||
* @param int $code
|
||||
* @param Throwable|null $previous
|
||||
*/
|
||||
public function __construct(
|
||||
$message = 'A filepath needs to be passed.',
|
||||
|
@@ -8,9 +8,9 @@ use Throwable;
|
||||
class NoFilenameGivenException extends InvalidArgumentException implements LaravelExcelException
|
||||
{
|
||||
/**
|
||||
* @param string $message
|
||||
* @param int $code
|
||||
* @param Throwable|null $previous
|
||||
* @param string $message
|
||||
* @param int $code
|
||||
* @param Throwable|null $previous
|
||||
*/
|
||||
public function __construct(
|
||||
$message = 'A filename needs to be passed in order to download the export',
|
||||
|
@@ -8,9 +8,9 @@ use Throwable;
|
||||
class NoTypeDetectedException extends Exception implements LaravelExcelException
|
||||
{
|
||||
/**
|
||||
* @param string $message
|
||||
* @param int $code
|
||||
* @param Throwable|null $previous
|
||||
* @param string $message
|
||||
* @param int $code
|
||||
* @param Throwable|null $previous
|
||||
*/
|
||||
public function __construct(
|
||||
$message = 'No ReaderType or WriterType could be detected. Make sure you either pass a valid extension to the filename or pass an explicit type.',
|
||||
|
@@ -14,7 +14,7 @@ class RowSkippedException extends Exception
|
||||
private $failures;
|
||||
|
||||
/**
|
||||
* @param Failure ...$failures
|
||||
* @param Failure ...$failures
|
||||
*/
|
||||
public function __construct(Failure ...$failures)
|
||||
{
|
||||
|
@@ -5,8 +5,7 @@ namespace Maatwebsite\Excel\Exceptions;
|
||||
class SheetNotFoundException extends \Exception implements LaravelExcelException
|
||||
{
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @param string $name
|
||||
* @return SheetNotFoundException
|
||||
*/
|
||||
public static function byName(string $name): SheetNotFoundException
|
||||
@@ -15,9 +14,8 @@ class SheetNotFoundException extends \Exception implements LaravelExcelException
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $index
|
||||
* @param int $sheetCount
|
||||
*
|
||||
* @param int $index
|
||||
* @param int $sheetCount
|
||||
* @return SheetNotFoundException
|
||||
*/
|
||||
public static function byIndex(int $index, int $sheetCount): SheetNotFoundException
|
||||
|
@@ -8,9 +8,9 @@ use Throwable;
|
||||
class UnreadableFileException extends Exception implements LaravelExcelException
|
||||
{
|
||||
/**
|
||||
* @param string $message
|
||||
* @param int $code
|
||||
* @param Throwable|null $previous
|
||||
* @param string $message
|
||||
* @param int $code
|
||||
* @param Throwable|null $previous
|
||||
*/
|
||||
public function __construct(
|
||||
$message = 'File could not be read',
|
||||
|
38
vendor/maatwebsite/excel/src/Exporter.php
vendored
38
vendor/maatwebsite/excel/src/Exporter.php
vendored
@@ -5,45 +5,43 @@ namespace Maatwebsite\Excel;
|
||||
interface Exporter
|
||||
{
|
||||
/**
|
||||
* @param object $export
|
||||
* @param string|null $fileName
|
||||
* @param string $writerType
|
||||
* @param array $headers
|
||||
* @param object $export
|
||||
* @param string|null $fileName
|
||||
* @param string $writerType
|
||||
* @param array $headers
|
||||
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
||||
*/
|
||||
public function download($export, string $fileName, string $writerType = null, array $headers = []);
|
||||
|
||||
/**
|
||||
* @param object $export
|
||||
* @param string $filePath
|
||||
* @param string|null $disk
|
||||
* @param string $writerType
|
||||
* @param mixed $diskOptions
|
||||
* @param object $export
|
||||
* @param string $filePath
|
||||
* @param string|null $disk
|
||||
* @param string $writerType
|
||||
* @param mixed $diskOptions
|
||||
* @return bool
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
* @return bool
|
||||
*/
|
||||
public function store($export, string $filePath, string $disk = null, string $writerType = null, $diskOptions = []);
|
||||
|
||||
/**
|
||||
* @param object $export
|
||||
* @param string $filePath
|
||||
* @param string|null $disk
|
||||
* @param string $writerType
|
||||
* @param mixed $diskOptions
|
||||
*
|
||||
* @param object $export
|
||||
* @param string $filePath
|
||||
* @param string|null $disk
|
||||
* @param string $writerType
|
||||
* @param mixed $diskOptions
|
||||
* @return \Illuminate\Foundation\Bus\PendingDispatch
|
||||
*/
|
||||
public function queue($export, string $filePath, string $disk = null, string $writerType = null, $diskOptions = []);
|
||||
|
||||
/**
|
||||
* @param object $export
|
||||
* @param string $writerType
|
||||
*
|
||||
* @param object $export
|
||||
* @param string $writerType
|
||||
* @return string
|
||||
*/
|
||||
public function raw($export, string $writerType);
|
||||
|
@@ -14,6 +14,7 @@ use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
* @method static BinaryFileResponse download(object $export, string $fileName, string $writerType = null, array $headers = [])
|
||||
* @method static bool store(object $export, string $filePath, string $disk = null, string $writerType = null, $diskOptions = [])
|
||||
* @method static PendingDispatch queue(object $export, string $filePath, string $disk = null, string $writerType = null, $diskOptions = [])
|
||||
* @method static string raw(object $export, string $writerType)
|
||||
* @method static BaseExcel import(object $import, string|UploadedFile $filePath, string $disk = null, string $readerType = null)
|
||||
* @method static array toArray(object $import, string|UploadedFile $filePath, string $disk = null, string $readerType = null)
|
||||
* @method static Collection toCollection(object $import, string|UploadedFile $filePath, string $disk = null, string $readerType = null)
|
||||
@@ -24,6 +25,7 @@ use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
* @method static void assertStored(string $filePath, string|callable $disk = null, callable $callback = null)
|
||||
* @method static void assertQueued(string $filePath, string|callable $disk = null, callable $callback = null)
|
||||
* @method static void assertQueuedWithChain(array $chain)
|
||||
* @method static void assertExportedInRaw(string $classname, callable $callback = null)
|
||||
* @method static void assertImported(string $filePath, string|callable $disk = null, callable $callback = null)
|
||||
*/
|
||||
class Excel extends Facade
|
||||
|
@@ -20,12 +20,12 @@ class ReaderFactory
|
||||
use MapsCsvSettings;
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
* @param TemporaryFile $file
|
||||
* @param string $readerType
|
||||
* @param object $import
|
||||
* @param TemporaryFile $file
|
||||
* @param string $readerType
|
||||
* @return IReader
|
||||
*
|
||||
* @throws Exception
|
||||
* @return IReader
|
||||
*/
|
||||
public static function make($import, TemporaryFile $file, string $readerType = null): IReader
|
||||
{
|
||||
@@ -53,6 +53,9 @@ class ReaderFactory
|
||||
$reader->setEscapeCharacter(static::$escapeCharacter);
|
||||
$reader->setContiguous(static::$contiguous);
|
||||
$reader->setInputEncoding(static::$inputEncoding);
|
||||
if (method_exists($reader, 'setTestAutoDetect')) {
|
||||
$reader->setTestAutoDetect(static::$testAutoDetect);
|
||||
}
|
||||
}
|
||||
|
||||
if ($import instanceof WithReadFilter) {
|
||||
@@ -68,10 +71,10 @@ class ReaderFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @return string
|
||||
*
|
||||
* @throws NoTypeDetectedException
|
||||
* @return string
|
||||
*/
|
||||
private static function identify(TemporaryFile $temporaryFile): string
|
||||
{
|
||||
|
@@ -19,12 +19,12 @@ class WriterFactory
|
||||
use MapsCsvSettings;
|
||||
|
||||
/**
|
||||
* @param string $writerType
|
||||
* @param Spreadsheet $spreadsheet
|
||||
* @param object $export
|
||||
* @param string $writerType
|
||||
* @param Spreadsheet $spreadsheet
|
||||
* @param object $export
|
||||
* @return IWriter
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
* @return IWriter
|
||||
*/
|
||||
public static function make(string $writerType, Spreadsheet $spreadsheet, $export): IWriter
|
||||
{
|
||||
@@ -56,6 +56,7 @@ class WriterFactory
|
||||
$writer->setUseBOM(static::$useBom);
|
||||
$writer->setIncludeSeparatorLine(static::$includeSeparatorLine);
|
||||
$writer->setExcelCompatibility(static::$excelCompatibility);
|
||||
$writer->setOutputEncoding(static::$outputEncoding);
|
||||
}
|
||||
|
||||
// Calculation settings
|
||||
@@ -70,7 +71,6 @@ class WriterFactory
|
||||
|
||||
/**
|
||||
* @param $export
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function includesCharts($export): bool
|
||||
|
106
vendor/maatwebsite/excel/src/Fakes/ExcelFake.php
vendored
106
vendor/maatwebsite/excel/src/Fakes/ExcelFake.php
vendored
@@ -31,6 +31,11 @@ class ExcelFake implements Exporter, Importer
|
||||
*/
|
||||
protected $queued = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $raws = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
@@ -96,22 +101,22 @@ class ExcelFake implements Exporter, Importer
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $export
|
||||
* @param string $writerType
|
||||
*
|
||||
* @param object $export
|
||||
* @param string $writerType
|
||||
* @return string
|
||||
*/
|
||||
public function raw($export, string $writerType)
|
||||
{
|
||||
$this->raws[get_class($export)] = $export;
|
||||
|
||||
return 'RAW-CONTENTS';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
* @param string|UploadedFile $file
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
*
|
||||
* @param object $import
|
||||
* @param string|UploadedFile $file
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @return Reader|PendingDispatch
|
||||
*/
|
||||
public function import($import, $file, string $disk = null, string $readerType = null)
|
||||
@@ -128,11 +133,10 @@ class ExcelFake implements Exporter, Importer
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
* @param string|UploadedFile $file
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
*
|
||||
* @param object $import
|
||||
* @param string|UploadedFile $file
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($import, $file, string $disk = null, string $readerType = null): array
|
||||
@@ -145,11 +149,10 @@ class ExcelFake implements Exporter, Importer
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
* @param string|UploadedFile $file
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
*
|
||||
* @param object $import
|
||||
* @param string|UploadedFile $file
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @return Collection
|
||||
*/
|
||||
public function toCollection($import, $file, string $disk = null, string $readerType = null): Collection
|
||||
@@ -162,11 +165,10 @@ class ExcelFake implements Exporter, Importer
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ShouldQueue $import
|
||||
* @param string|UploadedFile $file
|
||||
* @param string|null $disk
|
||||
* @param string $readerType
|
||||
*
|
||||
* @param ShouldQueue $import
|
||||
* @param string|UploadedFile $file
|
||||
* @param string|null $disk
|
||||
* @param string $readerType
|
||||
* @return PendingDispatch
|
||||
*/
|
||||
public function queueImport(ShouldQueue $import, $file, string $disk = null, string $readerType = null)
|
||||
@@ -178,7 +180,7 @@ class ExcelFake implements Exporter, Importer
|
||||
$this->queued[$disk ?? 'default'][$filePath] = $import;
|
||||
$this->imported[$disk ?? 'default'][$filePath] = $import;
|
||||
|
||||
return new PendingDispatch(new class
|
||||
$this->job = new class
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
@@ -186,7 +188,11 @@ class ExcelFake implements Exporter, Importer
|
||||
{
|
||||
//
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Queue::push($this->job);
|
||||
|
||||
return new PendingDispatch($this->job);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,8 +218,8 @@ class ExcelFake implements Exporter, Importer
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fileName
|
||||
* @param callable|null $callback
|
||||
* @param string $fileName
|
||||
* @param callable|null $callback
|
||||
*/
|
||||
public function assertDownloaded(string $fileName, $callback = null)
|
||||
{
|
||||
@@ -230,9 +236,9 @@ class ExcelFake implements Exporter, Importer
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filePath
|
||||
* @param string|callable|null $disk
|
||||
* @param callable|null $callback
|
||||
* @param string $filePath
|
||||
* @param string|callable|null $disk
|
||||
* @param callable|null $callback
|
||||
*/
|
||||
public function assertStored(string $filePath, $disk = null, $callback = null)
|
||||
{
|
||||
@@ -261,9 +267,9 @@ class ExcelFake implements Exporter, Importer
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filePath
|
||||
* @param string|callable|null $disk
|
||||
* @param callable|null $callback
|
||||
* @param string $filePath
|
||||
* @param string|callable|null $disk
|
||||
* @param callable|null $callback
|
||||
*/
|
||||
public function assertQueued(string $filePath, $disk = null, $callback = null)
|
||||
{
|
||||
@@ -297,9 +303,27 @@ class ExcelFake implements Exporter, Importer
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filePath
|
||||
* @param string|callable|null $disk
|
||||
* @param callable|null $callback
|
||||
* @param string $classname
|
||||
* @param callable|null $callback
|
||||
*/
|
||||
public function assertExportedInRaw(string $classname, $callback = null)
|
||||
{
|
||||
Assert::assertArrayHasKey($classname, $this->raws, sprintf('%s is not exported in raw', $classname));
|
||||
|
||||
$callback = $callback ?: function () {
|
||||
return true;
|
||||
};
|
||||
|
||||
Assert::assertTrue(
|
||||
$callback($this->raws[$classname]),
|
||||
"The [{$classname}] export was not exported in raw with the expected data."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filePath
|
||||
* @param string|callable|null $disk
|
||||
* @param callable|null $callback
|
||||
*/
|
||||
public function assertImported(string $filePath, $disk = null, $callback = null)
|
||||
{
|
||||
@@ -329,12 +353,12 @@ class ExcelFake implements Exporter, Importer
|
||||
|
||||
/**
|
||||
* Asserts that an array has a specified key and returns the key if successful.
|
||||
*
|
||||
* @see matchByRegex for more information about file path matching
|
||||
*
|
||||
* @param string $key
|
||||
* @param array $array
|
||||
* @param string $message
|
||||
*
|
||||
* @param string $key
|
||||
* @param array $array
|
||||
* @param string $message
|
||||
* @return string
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
@@ -349,7 +373,7 @@ class ExcelFake implements Exporter, Importer
|
||||
Assert::assertGreaterThan(0, count($results), $message);
|
||||
Assert::assertEquals(1, count($results), "More than one result matches the file name expression '$key'.");
|
||||
|
||||
return $results[0];
|
||||
return array_values($results)[0];
|
||||
}
|
||||
Assert::assertArrayHasKey($key, $disk, $message);
|
||||
|
||||
|
23
vendor/maatwebsite/excel/src/Files/Disk.php
vendored
23
vendor/maatwebsite/excel/src/Files/Disk.php
vendored
@@ -28,9 +28,9 @@ class Disk
|
||||
protected $diskOptions;
|
||||
|
||||
/**
|
||||
* @param IlluminateFilesystem $disk
|
||||
* @param string|null $name
|
||||
* @param array $diskOptions
|
||||
* @param IlluminateFilesystem $disk
|
||||
* @param string|null $name
|
||||
* @param array $diskOptions
|
||||
*/
|
||||
public function __construct(IlluminateFilesystem $disk, string $name = null, array $diskOptions = [])
|
||||
{
|
||||
@@ -40,9 +40,8 @@ class Disk
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $arguments
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $arguments
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($name, $arguments)
|
||||
@@ -51,9 +50,8 @@ class Disk
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $destination
|
||||
* @param string|resource $contents
|
||||
*
|
||||
* @param string $destination
|
||||
* @param string|resource $contents
|
||||
* @return bool
|
||||
*/
|
||||
public function put(string $destination, $contents): bool
|
||||
@@ -62,9 +60,8 @@ class Disk
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TemporaryFile $source
|
||||
* @param string $destination
|
||||
*
|
||||
* @param TemporaryFile $source
|
||||
* @param string $destination
|
||||
* @return bool
|
||||
*/
|
||||
public function copy(TemporaryFile $source, string $destination): bool
|
||||
@@ -90,7 +87,7 @@ class Disk
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @param string $filename
|
||||
*/
|
||||
public function touch(string $filename)
|
||||
{
|
||||
|
@@ -12,7 +12,7 @@ class Filesystem
|
||||
private $filesystem;
|
||||
|
||||
/**
|
||||
* @param Factory $filesystem
|
||||
* @param Factory $filesystem
|
||||
*/
|
||||
public function __construct(Factory $filesystem)
|
||||
{
|
||||
@@ -20,9 +20,8 @@ class Filesystem
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $disk
|
||||
* @param array $diskOptions
|
||||
*
|
||||
* @param string|null $disk
|
||||
* @param array $diskOptions
|
||||
* @return Disk
|
||||
*/
|
||||
public function disk(string $disk = null, array $diskOptions = []): Disk
|
||||
|
@@ -10,7 +10,7 @@ class LocalTemporaryFile extends TemporaryFile
|
||||
private $filePath;
|
||||
|
||||
/**
|
||||
* @param string $filePath
|
||||
* @param string $filePath
|
||||
*/
|
||||
public function __construct(string $filePath)
|
||||
{
|
||||
|
@@ -25,9 +25,9 @@ class RemoteTemporaryFile extends TemporaryFile
|
||||
private $localTemporaryFile;
|
||||
|
||||
/**
|
||||
* @param string $disk
|
||||
* @param string $filename
|
||||
* @param LocalTemporaryFile $localTemporaryFile
|
||||
* @param string $disk
|
||||
* @param string $filename
|
||||
* @param LocalTemporaryFile $localTemporaryFile
|
||||
*/
|
||||
public function __construct(string $disk, string $filename, LocalTemporaryFile $localTemporaryFile)
|
||||
{
|
||||
@@ -133,7 +133,7 @@ class RemoteTemporaryFile extends TemporaryFile
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|resource $contents
|
||||
* @param string|resource $contents
|
||||
*/
|
||||
public function put($contents)
|
||||
{
|
||||
|
@@ -45,9 +45,8 @@ abstract class TemporaryFile
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|UploadedFile $filePath
|
||||
* @param string|null $disk
|
||||
*
|
||||
* @param string|UploadedFile $filePath
|
||||
* @param string|null $disk
|
||||
* @return TemporaryFile
|
||||
*/
|
||||
public function copyFrom($filePath, string $disk = null): TemporaryFile
|
||||
|
@@ -17,8 +17,8 @@ class TemporaryFileFactory
|
||||
private $temporaryDisk;
|
||||
|
||||
/**
|
||||
* @param string|null $temporaryPath
|
||||
* @param string|null $temporaryDisk
|
||||
* @param string|null $temporaryPath
|
||||
* @param string|null $temporaryDisk
|
||||
*/
|
||||
public function __construct(string $temporaryPath = null, string $temporaryDisk = null)
|
||||
{
|
||||
@@ -27,8 +27,7 @@ class TemporaryFileFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $fileExtension
|
||||
*
|
||||
* @param string|null $fileExtension
|
||||
* @return TemporaryFile
|
||||
*/
|
||||
public function make(string $fileExtension = null): TemporaryFile
|
||||
@@ -41,10 +40,8 @@ class TemporaryFileFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $fileName
|
||||
*
|
||||
* @param string|null $fileExtension
|
||||
*
|
||||
* @param string|null $fileName
|
||||
* @param string|null $fileExtension
|
||||
* @return LocalTemporaryFile
|
||||
*/
|
||||
public function makeLocal(string $fileName = null, string $fileExtension = null): LocalTemporaryFile
|
||||
@@ -59,8 +56,7 @@ class TemporaryFileFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $fileExtension
|
||||
*
|
||||
* @param string|null $fileExtension
|
||||
* @return RemoteTemporaryFile
|
||||
*/
|
||||
private function makeRemote(string $fileExtension = null): RemoteTemporaryFile
|
||||
@@ -75,8 +71,7 @@ class TemporaryFileFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $fileExtension
|
||||
*
|
||||
* @param string|null $fileExtension
|
||||
* @return string
|
||||
*/
|
||||
private function generateFilename(string $fileExtension = null): string
|
||||
|
@@ -27,10 +27,10 @@ class ChunkReadFilter implements IReadFilter
|
||||
private $worksheetName;
|
||||
|
||||
/**
|
||||
* @param int $headingRow
|
||||
* @param int $startRow
|
||||
* @param int $chunkSize
|
||||
* @param string $worksheetName
|
||||
* @param int $headingRow
|
||||
* @param int $startRow
|
||||
* @param int $chunkSize
|
||||
* @param string $worksheetName
|
||||
*/
|
||||
public function __construct(int $headingRow, int $startRow, int $chunkSize, string $worksheetName)
|
||||
{
|
||||
@@ -41,10 +41,9 @@ class ChunkReadFilter implements IReadFilter
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $column
|
||||
* @param int $row
|
||||
* @param string $worksheetName
|
||||
*
|
||||
* @param string $column
|
||||
* @param int $row
|
||||
* @param string $worksheetName
|
||||
* @return bool
|
||||
*/
|
||||
public function readCell($column, $row, $worksheetName = '')
|
||||
|
@@ -17,8 +17,8 @@ class LimitFilter implements IReadFilter
|
||||
private $endRow;
|
||||
|
||||
/**
|
||||
* @param int $startRow
|
||||
* @param int $limit
|
||||
* @param int $startRow
|
||||
* @param int $limit
|
||||
*/
|
||||
public function __construct(int $startRow, int $limit)
|
||||
{
|
||||
@@ -27,10 +27,9 @@ class LimitFilter implements IReadFilter
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $column
|
||||
* @param int $row
|
||||
* @param string $worksheetName
|
||||
*
|
||||
* @param string $column
|
||||
* @param int $row
|
||||
* @param string $worksheetName
|
||||
* @return bool
|
||||
*/
|
||||
public function readCell($column, $row, $worksheetName = '')
|
||||
|
11
vendor/maatwebsite/excel/src/HasEventBus.php
vendored
11
vendor/maatwebsite/excel/src/HasEventBus.php
vendored
@@ -17,7 +17,7 @@ trait HasEventBus
|
||||
/**
|
||||
* Register local event listeners.
|
||||
*
|
||||
* @param array $listeners
|
||||
* @param array $listeners
|
||||
*/
|
||||
public function registerListeners(array $listeners)
|
||||
{
|
||||
@@ -34,8 +34,8 @@ trait HasEventBus
|
||||
/**
|
||||
* Register a global event listener.
|
||||
*
|
||||
* @param string $event
|
||||
* @param callable $listener
|
||||
* @param string $event
|
||||
* @param callable $listener
|
||||
*/
|
||||
public static function listen(string $event, callable $listener)
|
||||
{
|
||||
@@ -43,7 +43,7 @@ trait HasEventBus
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $event
|
||||
* @param object $event
|
||||
*/
|
||||
public function raise($event)
|
||||
{
|
||||
@@ -53,8 +53,7 @@ trait HasEventBus
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $event
|
||||
*
|
||||
* @param object $event
|
||||
* @return callable[]
|
||||
*/
|
||||
public function listeners($event): array
|
||||
|
@@ -18,7 +18,7 @@ class HeadingRowImport implements WithStartRow, WithLimit, WithMapping
|
||||
private $headingRow;
|
||||
|
||||
/**
|
||||
* @param int $headingRow
|
||||
* @param int $headingRow
|
||||
*/
|
||||
public function __construct(int $headingRow = 1)
|
||||
{
|
||||
@@ -42,8 +42,7 @@ class HeadingRowImport implements WithStartRow, WithLimit, WithMapping
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $row
|
||||
*
|
||||
* @param mixed $row
|
||||
* @return array
|
||||
*/
|
||||
public function map($row): array
|
||||
|
@@ -5,8 +5,7 @@ namespace Maatwebsite\Excel\Helpers;
|
||||
class ArrayHelper
|
||||
{
|
||||
/**
|
||||
* @param array $array
|
||||
*
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
public static function ensureMultipleRows(array $array): array
|
||||
@@ -22,8 +21,7 @@ class ArrayHelper
|
||||
* Only have multiple rows, if each
|
||||
* element in the array is an array itself.
|
||||
*
|
||||
* @param array $array
|
||||
*
|
||||
* @param array $array
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasMultipleRows(array $array): bool
|
||||
|
@@ -5,8 +5,7 @@ namespace Maatwebsite\Excel\Helpers;
|
||||
class CellHelper
|
||||
{
|
||||
/**
|
||||
* @param string $coordinate
|
||||
*
|
||||
* @param string $coordinate
|
||||
* @return string
|
||||
*/
|
||||
public static function getColumnFromCoordinate(string $coordinate): string
|
||||
|
@@ -8,11 +8,11 @@ use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
class FileTypeDetector
|
||||
{
|
||||
/**
|
||||
* @param $filePath
|
||||
* @param string|null $type
|
||||
* @param $filePath
|
||||
* @param string|null $type
|
||||
* @return string|null
|
||||
*
|
||||
* @throws NoTypeDetectedException
|
||||
* @return string|null
|
||||
*/
|
||||
public static function detect($filePath, string $type = null)
|
||||
{
|
||||
@@ -35,11 +35,11 @@ class FileTypeDetector
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filePath
|
||||
* @param string|null $type
|
||||
* @param string $filePath
|
||||
* @param string|null $type
|
||||
* @return string
|
||||
*
|
||||
* @throws NoTypeDetectedException
|
||||
* @return string
|
||||
*/
|
||||
public static function detectStrict(string $filePath, string $type = null): string
|
||||
{
|
||||
|
36
vendor/maatwebsite/excel/src/Importer.php
vendored
36
vendor/maatwebsite/excel/src/Importer.php
vendored
@@ -8,41 +8,37 @@ use Illuminate\Support\Collection;
|
||||
interface Importer
|
||||
{
|
||||
/**
|
||||
* @param object $import
|
||||
* @param string|\Symfony\Component\HttpFoundation\File\UploadedFile $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
*
|
||||
* @param object $import
|
||||
* @param string|\Symfony\Component\HttpFoundation\File\UploadedFile $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @return Reader|\Illuminate\Foundation\Bus\PendingDispatch
|
||||
*/
|
||||
public function import($import, $filePath, string $disk = null, string $readerType = null);
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
* @param string|\Symfony\Component\HttpFoundation\File\UploadedFile $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
*
|
||||
* @param object $import
|
||||
* @param string|\Symfony\Component\HttpFoundation\File\UploadedFile $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($import, $filePath, string $disk = null, string $readerType = null): array;
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
* @param string|\Symfony\Component\HttpFoundation\File\UploadedFile $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
*
|
||||
* @param object $import
|
||||
* @param string|\Symfony\Component\HttpFoundation\File\UploadedFile $filePath
|
||||
* @param string|null $disk
|
||||
* @param string|null $readerType
|
||||
* @return Collection
|
||||
*/
|
||||
public function toCollection($import, $filePath, string $disk = null, string $readerType = null): Collection;
|
||||
|
||||
/**
|
||||
* @param ShouldQueue $import
|
||||
* @param string|\Symfony\Component\HttpFoundation\File\UploadedFile $filePath
|
||||
* @param string|null $disk
|
||||
* @param string $readerType
|
||||
*
|
||||
* @param ShouldQueue $import
|
||||
* @param string|\Symfony\Component\HttpFoundation\File\UploadedFile $filePath
|
||||
* @param string|null $disk
|
||||
* @param string $readerType
|
||||
* @return \Illuminate\Foundation\Bus\PendingDispatch
|
||||
*/
|
||||
public function queueImport(ShouldQueue $import, $filePath, string $disk = null, string $readerType = null);
|
||||
|
@@ -7,11 +7,9 @@ use Maatwebsite\Excel\Concerns\WithLimit;
|
||||
class EndRowFinder
|
||||
{
|
||||
/**
|
||||
* @param object|WithLimit $import
|
||||
* @param int $startRow
|
||||
*
|
||||
* @param int|null $highestRow
|
||||
*
|
||||
* @param object|WithLimit $import
|
||||
* @param int $startRow
|
||||
* @param int|null $highestRow
|
||||
* @return int|null
|
||||
*/
|
||||
public static function find($import, int $startRow = null, int $highestRow = null)
|
||||
|
@@ -3,6 +3,7 @@
|
||||
namespace Maatwebsite\Excel\Imports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\WithColumnLimit;
|
||||
use Maatwebsite\Excel\Concerns\WithGroupedHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithStartRow;
|
||||
use Maatwebsite\Excel\Row;
|
||||
@@ -16,8 +17,7 @@ class HeadingRowExtractor
|
||||
const DEFAULT_HEADING_ROW = 1;
|
||||
|
||||
/**
|
||||
* @param WithHeadingRow|mixed $importable
|
||||
*
|
||||
* @param WithHeadingRow|mixed $importable
|
||||
* @return int
|
||||
*/
|
||||
public static function headingRow($importable): int
|
||||
@@ -28,8 +28,7 @@ class HeadingRowExtractor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WithHeadingRow|mixed $importable
|
||||
*
|
||||
* @param WithHeadingRow|mixed $importable
|
||||
* @return int
|
||||
*/
|
||||
public static function determineStartRow($importable): int
|
||||
@@ -45,9 +44,8 @@ class HeadingRowExtractor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Worksheet $worksheet
|
||||
* @param WithHeadingRow|mixed $importable
|
||||
*
|
||||
* @param Worksheet $worksheet
|
||||
* @param WithHeadingRow|mixed $importable
|
||||
* @return array
|
||||
*/
|
||||
public static function extract(Worksheet $worksheet, $importable): array
|
||||
@@ -63,4 +61,26 @@ class HeadingRowExtractor
|
||||
|
||||
return HeadingRowFormatter::format((new Row($headingRow))->toArray(null, false, false, $endColumn));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $headingRow
|
||||
* @param WithGroupedHeadingRow|mixed $importable
|
||||
* @return array
|
||||
*/
|
||||
public static function extractGrouping($headingRow, $importable)
|
||||
{
|
||||
$headerIsGrouped = array_fill(0, count($headingRow), false);
|
||||
|
||||
if (!$importable instanceof WithGroupedHeadingRow) {
|
||||
return $headerIsGrouped;
|
||||
}
|
||||
|
||||
array_walk($headerIsGrouped, function (&$value, $key) use ($headingRow) {
|
||||
if (array_count_values($headingRow)[$headingRow[$key]] > 1) {
|
||||
$value = true;
|
||||
}
|
||||
});
|
||||
|
||||
return $headerIsGrouped;
|
||||
}
|
||||
}
|
||||
|
@@ -37,8 +37,7 @@ class HeadingRowFormatter
|
||||
];
|
||||
|
||||
/**
|
||||
* @param array $headings
|
||||
*
|
||||
* @param array $headings
|
||||
* @return array
|
||||
*/
|
||||
public static function format(array $headings): array
|
||||
@@ -49,7 +48,7 @@ class HeadingRowFormatter
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $name
|
||||
*/
|
||||
public static function default(string $name = null)
|
||||
{
|
||||
@@ -61,8 +60,8 @@ class HeadingRowFormatter
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param callable $formatter
|
||||
* @param string $name
|
||||
* @param callable $formatter
|
||||
*/
|
||||
public static function extend(string $name, callable $formatter)
|
||||
{
|
||||
@@ -78,8 +77,7 @@ class HeadingRowFormatter
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
protected static function callFormatter($value, $key=null)
|
||||
@@ -93,6 +91,10 @@ class HeadingRowFormatter
|
||||
return $formatter($value, $key);
|
||||
}
|
||||
|
||||
if (empty($value)) {
|
||||
return $key;
|
||||
}
|
||||
|
||||
if (static::$formatter === self::FORMATTER_SLUG) {
|
||||
return Str::slug($value, '_');
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ class ModelImporter
|
||||
private $manager;
|
||||
|
||||
/**
|
||||
* @param ModelManager $manager
|
||||
* @param ModelManager $manager
|
||||
*/
|
||||
public function __construct(ModelManager $manager)
|
||||
{
|
||||
@@ -30,10 +30,10 @@ class ModelImporter
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Worksheet $worksheet
|
||||
* @param ToModel $import
|
||||
* @param int|null $startRow
|
||||
* @param string|null $endColumn
|
||||
* @param Worksheet $worksheet
|
||||
* @param ToModel $import
|
||||
* @param int|null $startRow
|
||||
* @param string|null $endColumn
|
||||
*
|
||||
* @throws \Maatwebsite\Excel\Validators\ValidationException
|
||||
*/
|
||||
@@ -44,6 +44,7 @@ class ModelImporter
|
||||
}
|
||||
|
||||
$headingRow = HeadingRowExtractor::extract($worksheet, $import);
|
||||
$headerIsGrouped = HeadingRowExtractor::extractGrouping($headingRow, $import);
|
||||
$batchSize = $import instanceof WithBatchInserts ? $import->batchSize() : 1;
|
||||
$endRow = EndRowFinder::find($import, $startRow, $worksheet->getHighestRow());
|
||||
$progessBar = $import instanceof WithProgressBar;
|
||||
@@ -59,8 +60,8 @@ class ModelImporter
|
||||
foreach ($worksheet->getRowIterator($startRow, $endRow) as $spreadSheetRow) {
|
||||
$i++;
|
||||
|
||||
$row = new Row($spreadSheetRow, $headingRow);
|
||||
if (!$import instanceof SkipsEmptyRows || ($import instanceof SkipsEmptyRows && !$row->isEmpty())) {
|
||||
$row = new Row($spreadSheetRow, $headingRow, $headerIsGrouped);
|
||||
if (!$import instanceof SkipsEmptyRows || ($import instanceof SkipsEmptyRows && !$row->isEmpty($withCalcFormulas))) {
|
||||
$rowArray = $row->toArray(null, $withCalcFormulas, $formatData, $endColumn);
|
||||
|
||||
if ($withValidation) {
|
||||
|
@@ -31,7 +31,7 @@ class ModelManager
|
||||
private $remembersRowNumber = false;
|
||||
|
||||
/**
|
||||
* @param RowValidator $validator
|
||||
* @param RowValidator $validator
|
||||
*/
|
||||
public function __construct(RowValidator $validator)
|
||||
{
|
||||
@@ -39,8 +39,8 @@ class ModelManager
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $row
|
||||
* @param array $attributes
|
||||
* @param int $row
|
||||
* @param array $attributes
|
||||
*/
|
||||
public function add(int $row, array $attributes)
|
||||
{
|
||||
@@ -48,7 +48,7 @@ class ModelManager
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $remembersRowNumber
|
||||
* @param bool $remembersRowNumber
|
||||
*/
|
||||
public function setRemembersRowNumber(bool $remembersRowNumber)
|
||||
{
|
||||
@@ -56,8 +56,8 @@ class ModelManager
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ToModel $import
|
||||
* @param bool $massInsert
|
||||
* @param ToModel $import
|
||||
* @param bool $massInsert
|
||||
*
|
||||
* @throws ValidationException
|
||||
*/
|
||||
@@ -77,10 +77,9 @@ class ModelManager
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ToModel $import
|
||||
* @param array $attributes
|
||||
*
|
||||
* @param int|null $rowNumber
|
||||
* @param ToModel $import
|
||||
* @param array $attributes
|
||||
* @param int|null $rowNumber
|
||||
* @return Model[]|Collection
|
||||
*/
|
||||
public function toModels(ToModel $import, array $attributes, $rowNumber = null): Collection
|
||||
@@ -99,7 +98,7 @@ class ModelManager
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ToModel $import
|
||||
* @param ToModel $import
|
||||
*/
|
||||
private function massFlush(ToModel $import)
|
||||
{
|
||||
@@ -134,7 +133,7 @@ class ModelManager
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ToModel $import
|
||||
* @param ToModel $import
|
||||
*/
|
||||
private function singleFlush(ToModel $import)
|
||||
{
|
||||
@@ -164,8 +163,7 @@ class ModelManager
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model $model
|
||||
*
|
||||
* @param Model $model
|
||||
* @return Model
|
||||
*/
|
||||
private function prepare(Model $model): Model
|
||||
@@ -192,7 +190,7 @@ class ModelManager
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WithValidation $import
|
||||
* @param WithValidation $import
|
||||
*
|
||||
* @throws ValidationException
|
||||
*/
|
||||
|
@@ -25,8 +25,8 @@ class AfterImportJob implements ShouldQueue
|
||||
private $reader;
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
* @param Reader $reader
|
||||
* @param object $import
|
||||
* @param Reader $reader
|
||||
*/
|
||||
public function __construct($import, Reader $reader)
|
||||
{
|
||||
@@ -45,7 +45,7 @@ class AfterImportJob implements ShouldQueue
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Throwable $e
|
||||
* @param Throwable $e
|
||||
*/
|
||||
public function failed(Throwable $e)
|
||||
{
|
||||
|
@@ -5,13 +5,14 @@ namespace Maatwebsite\Excel\Jobs;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Maatwebsite\Excel\Files\TemporaryFile;
|
||||
use Maatwebsite\Excel\Jobs\Middleware\LocalizeJob;
|
||||
use Maatwebsite\Excel\Writer;
|
||||
|
||||
class AppendDataToSheet implements ShouldQueue
|
||||
{
|
||||
use Queueable, Dispatchable, ProxyFailures;
|
||||
use Queueable, Dispatchable, ProxyFailures, InteractsWithQueue;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
@@ -39,11 +40,11 @@ class AppendDataToSheet implements ShouldQueue
|
||||
public $sheetExport;
|
||||
|
||||
/**
|
||||
* @param object $sheetExport
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
* @param int $sheetIndex
|
||||
* @param array $data
|
||||
* @param object $sheetExport
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
* @param int $sheetIndex
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct($sheetExport, TemporaryFile $temporaryFile, string $writerType, int $sheetIndex, array $data)
|
||||
{
|
||||
@@ -65,7 +66,7 @@ class AppendDataToSheet implements ShouldQueue
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Writer $writer
|
||||
* @param Writer $writer
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
|
||||
|
@@ -5,6 +5,7 @@ namespace Maatwebsite\Excel\Jobs;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Files\TemporaryFile;
|
||||
use Maatwebsite\Excel\Jobs\Middleware\LocalizeJob;
|
||||
@@ -12,7 +13,7 @@ use Maatwebsite\Excel\Writer;
|
||||
|
||||
class AppendQueryToSheet implements ShouldQueue
|
||||
{
|
||||
use Queueable, Dispatchable, ProxyFailures;
|
||||
use Queueable, Dispatchable, ProxyFailures, InteractsWithQueue;
|
||||
|
||||
/**
|
||||
* @var TemporaryFile
|
||||
@@ -45,12 +46,12 @@ class AppendQueryToSheet implements ShouldQueue
|
||||
public $chunkSize;
|
||||
|
||||
/**
|
||||
* @param FromQuery $sheetExport
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
* @param int $sheetIndex
|
||||
* @param int $page
|
||||
* @param int $chunkSize
|
||||
* @param FromQuery $sheetExport
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
* @param int $sheetIndex
|
||||
* @param int $page
|
||||
* @param int $chunkSize
|
||||
*/
|
||||
public function __construct(
|
||||
FromQuery $sheetExport,
|
||||
@@ -79,7 +80,7 @@ class AppendQueryToSheet implements ShouldQueue
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Writer $writer
|
||||
* @param Writer $writer
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
|
||||
|
@@ -5,6 +5,7 @@ namespace Maatwebsite\Excel\Jobs;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
use Maatwebsite\Excel\Files\TemporaryFile;
|
||||
use Maatwebsite\Excel\Jobs\Middleware\LocalizeJob;
|
||||
@@ -12,7 +13,7 @@ use Maatwebsite\Excel\Writer;
|
||||
|
||||
class AppendViewToSheet implements ShouldQueue
|
||||
{
|
||||
use Queueable, Dispatchable;
|
||||
use Queueable, Dispatchable, InteractsWithQueue;
|
||||
|
||||
/**
|
||||
* @var TemporaryFile
|
||||
@@ -35,11 +36,11 @@ class AppendViewToSheet implements ShouldQueue
|
||||
public $sheetExport;
|
||||
|
||||
/**
|
||||
* @param FromView $sheetExport
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
* @param int $sheetIndex
|
||||
* @param array $data
|
||||
* @param FromView $sheetExport
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
* @param int $sheetIndex
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(FromView $sheetExport, TemporaryFile $temporaryFile, string $writerType, int $sheetIndex)
|
||||
{
|
||||
@@ -60,7 +61,7 @@ class AppendViewToSheet implements ShouldQueue
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Writer $writer
|
||||
* @param Writer $writer
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
|
||||
|
10
vendor/maatwebsite/excel/src/Jobs/CloseSheet.php
vendored
10
vendor/maatwebsite/excel/src/Jobs/CloseSheet.php
vendored
@@ -33,10 +33,10 @@ class CloseSheet implements ShouldQueue
|
||||
private $sheetIndex;
|
||||
|
||||
/**
|
||||
* @param object $sheetExport
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
* @param int $sheetIndex
|
||||
* @param object $sheetExport
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
* @param int $sheetIndex
|
||||
*/
|
||||
public function __construct($sheetExport, TemporaryFile $temporaryFile, string $writerType, int $sheetIndex)
|
||||
{
|
||||
@@ -47,7 +47,7 @@ class CloseSheet implements ShouldQueue
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Writer $writer
|
||||
* @param Writer $writer
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
|
||||
|
@@ -12,13 +12,12 @@ trait ExtendedQueueable
|
||||
|
||||
/**
|
||||
* @param $chain
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function chain($chain)
|
||||
{
|
||||
collect($chain)->each(function ($job) {
|
||||
$serialized = method_exists($this, 'serializeJob') ? $this->serializeJob($job) : serialize($job);
|
||||
$serialized = method_exists($this, 'serializeJob') ? $this->serializeJob($job) : serialize($job);
|
||||
$this->chained[] = $serialized;
|
||||
});
|
||||
|
||||
|
@@ -18,7 +18,7 @@ class LocalizeJob
|
||||
/**
|
||||
* LocalizeJob constructor.
|
||||
*
|
||||
* @param object $localizable
|
||||
* @param object $localizable
|
||||
*/
|
||||
public function __construct($localizable)
|
||||
{
|
||||
@@ -28,8 +28,8 @@ class LocalizeJob
|
||||
/**
|
||||
* Handles the job.
|
||||
*
|
||||
* @param mixed $job
|
||||
* @param Closure $next
|
||||
* @param mixed $job
|
||||
* @param Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($job, Closure $next)
|
||||
|
@@ -7,7 +7,7 @@ use Throwable;
|
||||
trait ProxyFailures
|
||||
{
|
||||
/**
|
||||
* @param Throwable $e
|
||||
* @param Throwable $e
|
||||
*/
|
||||
public function failed(Throwable $e)
|
||||
{
|
||||
|
@@ -30,9 +30,9 @@ class QueueExport implements ShouldQueue
|
||||
private $temporaryFile;
|
||||
|
||||
/**
|
||||
* @param object $export
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
* @param object $export
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
*/
|
||||
public function __construct($export, TemporaryFile $temporaryFile, string $writerType)
|
||||
{
|
||||
@@ -52,7 +52,7 @@ class QueueExport implements ShouldQueue
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Writer $writer
|
||||
* @param Writer $writer
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
@@ -78,7 +78,7 @@ class QueueExport implements ShouldQueue
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Throwable $e
|
||||
* @param Throwable $e
|
||||
*/
|
||||
public function failed(Throwable $e)
|
||||
{
|
||||
|
@@ -20,7 +20,7 @@ class QueueImport implements ShouldQueue
|
||||
public $timeout;
|
||||
|
||||
/**
|
||||
* @param ShouldQueue $import
|
||||
* @param ShouldQueue $import
|
||||
*/
|
||||
public function __construct(ShouldQueue $import = null)
|
||||
{
|
||||
|
@@ -31,10 +31,10 @@ class StoreQueuedExport implements ShouldQueue
|
||||
private $diskOptions;
|
||||
|
||||
/**
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $filePath
|
||||
* @param string|null $disk
|
||||
* @param array|string $diskOptions
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $filePath
|
||||
* @param string|null $disk
|
||||
* @param array|string $diskOptions
|
||||
*/
|
||||
public function __construct(TemporaryFile $temporaryFile, string $filePath, string $disk = null, $diskOptions = [])
|
||||
{
|
||||
@@ -45,7 +45,7 @@ class StoreQueuedExport implements ShouldQueue
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Filesystem $filesystem
|
||||
* @param Filesystem $filesystem
|
||||
*/
|
||||
public function handle(Filesystem $filesystem)
|
||||
{
|
||||
|
@@ -14,8 +14,8 @@ use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
class MappedReader
|
||||
{
|
||||
/**
|
||||
* @param WithMappedCells $import
|
||||
* @param Worksheet $worksheet
|
||||
* @param WithMappedCells $import
|
||||
* @param Worksheet $worksheet
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
|
@@ -16,7 +16,7 @@ class DownloadCollection
|
||||
*/
|
||||
public function downloadExcel()
|
||||
{
|
||||
return function (string $fileName, string $writerType = null, $withHeadings = false) {
|
||||
return function (string $fileName, string $writerType = null, $withHeadings = false, array $responseHeaders = []) {
|
||||
$export = new class($this, $withHeadings) implements FromCollection, WithHeadings
|
||||
{
|
||||
use Exportable;
|
||||
@@ -32,8 +32,8 @@ class DownloadCollection
|
||||
private $collection;
|
||||
|
||||
/**
|
||||
* @param Collection $collection
|
||||
* @param bool $withHeading
|
||||
* @param Collection $collection
|
||||
* @param bool $withHeading
|
||||
*/
|
||||
public function __construct(Collection $collection, bool $withHeading = false)
|
||||
{
|
||||
@@ -68,7 +68,7 @@ class DownloadCollection
|
||||
}
|
||||
};
|
||||
|
||||
return $export->download($fileName, $writerType);
|
||||
return $export->download($fileName, $writerType, $responseHeaders);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -30,8 +30,8 @@ class StoreCollection
|
||||
private $collection;
|
||||
|
||||
/**
|
||||
* @param Collection $collection
|
||||
* @param bool $withHeadings
|
||||
* @param Collection $collection
|
||||
* @param bool $withHeadings
|
||||
*/
|
||||
public function __construct(Collection $collection, bool $withHeadings = false)
|
||||
{
|
||||
|
52
vendor/maatwebsite/excel/src/QueuedWriter.php
vendored
52
vendor/maatwebsite/excel/src/QueuedWriter.php
vendored
@@ -38,8 +38,8 @@ class QueuedWriter
|
||||
protected $temporaryFileFactory;
|
||||
|
||||
/**
|
||||
* @param Writer $writer
|
||||
* @param TemporaryFileFactory $temporaryFileFactory
|
||||
* @param Writer $writer
|
||||
* @param TemporaryFileFactory $temporaryFileFactory
|
||||
*/
|
||||
public function __construct(Writer $writer, TemporaryFileFactory $temporaryFileFactory)
|
||||
{
|
||||
@@ -49,12 +49,11 @@ class QueuedWriter
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $export
|
||||
* @param string $filePath
|
||||
* @param string $disk
|
||||
* @param string|null $writerType
|
||||
* @param array|string $diskOptions
|
||||
*
|
||||
* @param object $export
|
||||
* @param string $filePath
|
||||
* @param string $disk
|
||||
* @param string|null $writerType
|
||||
* @param array|string $diskOptions
|
||||
* @return \Illuminate\Foundation\Bus\PendingDispatch
|
||||
*/
|
||||
public function store($export, string $filePath, string $disk = null, string $writerType = null, $diskOptions = [])
|
||||
@@ -77,10 +76,9 @@ class QueuedWriter
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $export
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
*
|
||||
* @param object $export
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
* @return Collection
|
||||
*/
|
||||
private function buildExportJobs($export, TemporaryFile $temporaryFile, string $writerType): Collection
|
||||
@@ -107,11 +105,10 @@ class QueuedWriter
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FromCollection $export
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
* @param int $sheetIndex
|
||||
*
|
||||
* @param FromCollection $export
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
* @param int $sheetIndex
|
||||
* @return Collection
|
||||
*/
|
||||
private function exportCollection(
|
||||
@@ -139,11 +136,10 @@ class QueuedWriter
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FromQuery $export
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
* @param int $sheetIndex
|
||||
*
|
||||
* @param FromQuery $export
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
* @param int $sheetIndex
|
||||
* @return Collection
|
||||
*/
|
||||
private function exportQuery(
|
||||
@@ -174,11 +170,10 @@ class QueuedWriter
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FromView $export
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
* @param int $sheetIndex
|
||||
*
|
||||
* @param FromView $export
|
||||
* @param TemporaryFile $temporaryFile
|
||||
* @param string $writerType
|
||||
* @param int $sheetIndex
|
||||
* @return Collection
|
||||
*/
|
||||
private function exportView(
|
||||
@@ -199,8 +194,7 @@ class QueuedWriter
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object|WithCustomChunkSize $export
|
||||
*
|
||||
* @param object|WithCustomChunkSize $export
|
||||
* @return int
|
||||
*/
|
||||
private function getChunkSize($export): int
|
||||
|
64
vendor/maatwebsite/excel/src/Reader.php
vendored
64
vendor/maatwebsite/excel/src/Reader.php
vendored
@@ -29,6 +29,7 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Throwable;
|
||||
|
||||
/** @mixin Spreadsheet */
|
||||
class Reader
|
||||
{
|
||||
use DelegatedMacroable, HasEventBus;
|
||||
@@ -64,8 +65,8 @@ class Reader
|
||||
protected $reader;
|
||||
|
||||
/**
|
||||
* @param TemporaryFileFactory $temporaryFileFactory
|
||||
* @param TransactionHandler $transaction
|
||||
* @param TemporaryFileFactory $temporaryFileFactory
|
||||
* @param TransactionHandler $transaction
|
||||
*/
|
||||
public function __construct(TemporaryFileFactory $temporaryFileFactory, TransactionHandler $transaction)
|
||||
{
|
||||
@@ -86,12 +87,12 @@ class Reader
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
* @param string|UploadedFile $filePath
|
||||
* @param string|null $readerType
|
||||
* @param string|null $disk
|
||||
*
|
||||
* @param object $import
|
||||
* @param string|UploadedFile $filePath
|
||||
* @param string|null $readerType
|
||||
* @param string|null $disk
|
||||
* @return \Illuminate\Foundation\Bus\PendingDispatch|$this
|
||||
*
|
||||
* @throws NoTypeDetectedException
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
* @throws Exception
|
||||
@@ -131,6 +132,7 @@ class Reader
|
||||
$this->afterImport($import);
|
||||
} catch (Throwable $e) {
|
||||
$this->raise(new ImportFailed($e));
|
||||
$this->garbageCollect();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
@@ -138,18 +140,18 @@ class Reader
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
* @param string|UploadedFile $filePath
|
||||
* @param string $readerType
|
||||
* @param string|null $disk
|
||||
*
|
||||
* @param object $import
|
||||
* @param string|UploadedFile $filePath
|
||||
* @param string $readerType
|
||||
* @param string|null $disk
|
||||
* @return array
|
||||
*
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
* @throws NoTypeDetectedException
|
||||
* @throws Exceptions\SheetNotFoundException
|
||||
*/
|
||||
public function toArray($import, $filePath, string $readerType, string $disk = null): array
|
||||
public function toArray($import, $filePath, string $readerType = null, string $disk = null): array
|
||||
{
|
||||
$this->reader = $this->getReader($import, $filePath, $readerType, $disk);
|
||||
|
||||
@@ -182,18 +184,18 @@ class Reader
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
* @param string|UploadedFile $filePath
|
||||
* @param string $readerType
|
||||
* @param string|null $disk
|
||||
*
|
||||
* @param object $import
|
||||
* @param string|UploadedFile $filePath
|
||||
* @param string $readerType
|
||||
* @param string|null $disk
|
||||
* @return Collection
|
||||
*
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
* @throws NoTypeDetectedException
|
||||
* @throws Exceptions\SheetNotFoundException
|
||||
*/
|
||||
public function toCollection($import, $filePath, string $readerType, string $disk = null): Collection
|
||||
public function toCollection($import, $filePath, string $readerType = null, string $disk = null): Collection
|
||||
{
|
||||
$this->reader = $this->getReader($import, $filePath, $readerType, $disk);
|
||||
$this->loadSpreadsheet($import);
|
||||
@@ -245,7 +247,7 @@ class Reader
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
* @param object $import
|
||||
*/
|
||||
public function loadSpreadsheet($import)
|
||||
{
|
||||
@@ -270,7 +272,7 @@ class Reader
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
* @param object $import
|
||||
*/
|
||||
public function beforeImport($import)
|
||||
{
|
||||
@@ -278,7 +280,7 @@ class Reader
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
* @param object $import
|
||||
*/
|
||||
public function afterImport($import)
|
||||
{
|
||||
@@ -296,8 +298,7 @@ class Reader
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
*
|
||||
* @param object $import
|
||||
* @return array
|
||||
*/
|
||||
public function getWorksheets($import): array
|
||||
@@ -357,8 +358,8 @@ class Reader
|
||||
* @param $import
|
||||
* @param $sheetImport
|
||||
* @param $index
|
||||
*
|
||||
* @return Sheet|null
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
* @throws SheetNotFoundException
|
||||
*/
|
||||
@@ -384,8 +385,7 @@ class Reader
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
*
|
||||
* @param object $import
|
||||
* @return array
|
||||
*/
|
||||
private function buildSheetImports($import): array
|
||||
@@ -408,12 +408,12 @@ class Reader
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
* @param string|UploadedFile $filePath
|
||||
* @param string|null $readerType
|
||||
* @param string $disk
|
||||
*
|
||||
* @param object $import
|
||||
* @param string|UploadedFile $filePath
|
||||
* @param string|null $readerType
|
||||
* @param string $disk
|
||||
* @return IReader
|
||||
*
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
* @throws NoTypeDetectedException
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
|
||||
|
@@ -21,9 +21,9 @@ trait RegistersCustomConcerns
|
||||
];
|
||||
|
||||
/**
|
||||
* @param string $concern
|
||||
* @param callable $handler
|
||||
* @param string $event
|
||||
* @param string $concern
|
||||
* @param callable $handler
|
||||
* @param string $event
|
||||
*/
|
||||
public static function extend(string $concern, callable $handler, string $event = BeforeWriting::class)
|
||||
{
|
||||
|
61
vendor/maatwebsite/excel/src/Row.php
vendored
61
vendor/maatwebsite/excel/src/Row.php
vendored
@@ -7,6 +7,7 @@ use Closure;
|
||||
use Illuminate\Support\Collection;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Row as SpreadsheetRow;
|
||||
|
||||
/** @mixin SpreadsheetRow */
|
||||
class Row implements ArrayAccess
|
||||
{
|
||||
use DelegatedMacroable;
|
||||
@@ -32,13 +33,20 @@ class Row implements ArrayAccess
|
||||
protected $rowCache;
|
||||
|
||||
/**
|
||||
* @param SpreadsheetRow $row
|
||||
* @param array $headingRow
|
||||
* @var bool|null
|
||||
*/
|
||||
public function __construct(SpreadsheetRow $row, array $headingRow = [])
|
||||
protected $rowCacheFormatData;
|
||||
|
||||
/**
|
||||
* @param SpreadsheetRow $row
|
||||
* @param array $headingRow
|
||||
* @param array $headerIsGrouped
|
||||
*/
|
||||
public function __construct(SpreadsheetRow $row, array $headingRow = [], array $headerIsGrouped = [])
|
||||
{
|
||||
$this->row = $row;
|
||||
$this->headingRow = $headingRow;
|
||||
$this->row = $row;
|
||||
$this->headingRow = $headingRow;
|
||||
$this->headerIsGrouped = $headerIsGrouped;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,12 +58,10 @@ class Row implements ArrayAccess
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $nullValue
|
||||
* @param bool $calculateFormulas
|
||||
* @param bool $formatData
|
||||
*
|
||||
* @param string|null $endColumn
|
||||
*
|
||||
* @param null $nullValue
|
||||
* @param bool $calculateFormulas
|
||||
* @param bool $formatData
|
||||
* @param string|null $endColumn
|
||||
* @return Collection
|
||||
*/
|
||||
public function toCollection($nullValue = null, $calculateFormulas = false, $formatData = true, ?string $endColumn = null): Collection
|
||||
@@ -64,16 +70,15 @@ class Row implements ArrayAccess
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $nullValue
|
||||
* @param bool $calculateFormulas
|
||||
* @param bool $formatData
|
||||
* @param string|null $endColumn
|
||||
*
|
||||
* @param null $nullValue
|
||||
* @param bool $calculateFormulas
|
||||
* @param bool $formatData
|
||||
* @param string|null $endColumn
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($nullValue = null, $calculateFormulas = false, $formatData = true, ?string $endColumn = null)
|
||||
{
|
||||
if (is_array($this->rowCache)) {
|
||||
if (is_array($this->rowCache) && ($this->rowCacheFormatData === $formatData)) {
|
||||
return $this->rowCache;
|
||||
}
|
||||
|
||||
@@ -84,7 +89,11 @@ class Row implements ArrayAccess
|
||||
$value = (new Cell($cell))->getValue($nullValue, $calculateFormulas, $formatData);
|
||||
|
||||
if (isset($this->headingRow[$i])) {
|
||||
$cells[$this->headingRow[$i]] = $value;
|
||||
if (!$this->headerIsGrouped[$i]) {
|
||||
$cells[$this->headingRow[$i]] = $value;
|
||||
} else {
|
||||
$cells[$this->headingRow[$i]][] = $value;
|
||||
}
|
||||
} else {
|
||||
$cells[] = $value;
|
||||
}
|
||||
@@ -96,17 +105,20 @@ class Row implements ArrayAccess
|
||||
$cells = ($this->preparationCallback)($cells, $this->row->getRowIndex());
|
||||
}
|
||||
|
||||
$this->rowCache = $cells;
|
||||
$this->rowCache = $cells;
|
||||
$this->rowCacheFormatData = $formatData;
|
||||
|
||||
return $cells;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $calculateFormulas
|
||||
* @param string|null $endColumn
|
||||
* @return bool
|
||||
*/
|
||||
public function isEmpty(): bool
|
||||
public function isEmpty($calculateFormulas = false, ?string $endColumn = null): bool
|
||||
{
|
||||
return count(array_filter($this->toArray(null, false, false))) === 0;
|
||||
return count(array_filter($this->toArray(null, $calculateFormulas, false, $endColumn))) === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,28 +129,33 @@ class Row implements ArrayAccess
|
||||
return $this->row->getRowIndex();
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset(($this->toArray())[$offset]);
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return ($this->toArray())[$offset];
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Closure $preparationCallback
|
||||
* @param \Closure $preparationCallback
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function setPreparationCallback(Closure $preparationCallback = null)
|
||||
|
162
vendor/maatwebsite/excel/src/Sheet.php
vendored
162
vendor/maatwebsite/excel/src/Sheet.php
vendored
@@ -58,6 +58,7 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
|
||||
/** @mixin Worksheet */
|
||||
class Sheet
|
||||
{
|
||||
use DelegatedMacroable, HasEventBus;
|
||||
@@ -83,7 +84,7 @@ class Sheet
|
||||
private $worksheet;
|
||||
|
||||
/**
|
||||
* @param Worksheet $worksheet
|
||||
* @param Worksheet $worksheet
|
||||
*/
|
||||
public function __construct(Worksheet $worksheet)
|
||||
{
|
||||
@@ -93,9 +94,8 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Spreadsheet $spreadsheet
|
||||
* @param string|int $index
|
||||
*
|
||||
* @param Spreadsheet $spreadsheet
|
||||
* @param string|int $index
|
||||
* @return Sheet
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
@@ -111,9 +111,8 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Spreadsheet $spreadsheet
|
||||
* @param int $index
|
||||
*
|
||||
* @param Spreadsheet $spreadsheet
|
||||
* @param int $index
|
||||
* @return Sheet
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
@@ -129,9 +128,8 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Spreadsheet $spreadsheet
|
||||
* @param string $name
|
||||
*
|
||||
* @param Spreadsheet $spreadsheet
|
||||
* @param string $name
|
||||
* @return Sheet
|
||||
*
|
||||
* @throws SheetNotFoundException
|
||||
@@ -146,7 +144,7 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $sheetExport
|
||||
* @param object $sheetExport
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
@@ -201,7 +199,7 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $sheetExport
|
||||
* @param object $sheetExport
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
|
||||
@@ -238,8 +236,8 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
* @param int $startRow
|
||||
* @param object $import
|
||||
* @param int $startRow
|
||||
*/
|
||||
public function import($import, int $startRow = 1)
|
||||
{
|
||||
@@ -268,7 +266,7 @@ class Sheet
|
||||
$rows = $this->toCollection($import, $startRow, null, $calculatesFormulas, $formatData);
|
||||
|
||||
if ($import instanceof WithValidation) {
|
||||
$this->validate($import, $startRow, $rows);
|
||||
$rows = $this->validated($import, $startRow, $rows);
|
||||
}
|
||||
|
||||
$import->collection($rows);
|
||||
@@ -278,7 +276,7 @@ class Sheet
|
||||
$rows = $this->toArray($import, $startRow, null, $calculatesFormulas, $formatData);
|
||||
|
||||
if ($import instanceof WithValidation) {
|
||||
$this->validate($import, $startRow, $rows);
|
||||
$rows = $this->validated($import, $startRow, $rows);
|
||||
}
|
||||
|
||||
$import->array($rows);
|
||||
@@ -287,15 +285,19 @@ class Sheet
|
||||
|
||||
if ($import instanceof OnEachRow) {
|
||||
$headingRow = HeadingRowExtractor::extract($this->worksheet, $import);
|
||||
$headerIsGrouped = HeadingRowExtractor::extractGrouping($headingRow, $import);
|
||||
$endColumn = $import instanceof WithColumnLimit ? $import->endColumn() : null;
|
||||
$preparationCallback = $this->getPreparationCallback($import);
|
||||
|
||||
foreach ($this->worksheet->getRowIterator()->resetStart($startRow ?? 1) as $row) {
|
||||
$sheetRow = new Row($row, $headingRow);
|
||||
$sheetRow = new Row($row, $headingRow, $headerIsGrouped);
|
||||
|
||||
if (!$import instanceof SkipsEmptyRows || ($import instanceof SkipsEmptyRows && !$sheetRow->isEmpty())) {
|
||||
if ($import instanceof WithValidation) {
|
||||
$sheetRow->setPreparationCallback($preparationCallback);
|
||||
}
|
||||
|
||||
if (!$import instanceof SkipsEmptyRows || ($import instanceof SkipsEmptyRows && !$sheetRow->isEmpty($calculatesFormulas))) {
|
||||
if ($import instanceof WithValidation) {
|
||||
$sheetRow->setPreparationCallback($preparationCallback);
|
||||
$toValidate = [$sheetRow->getIndex() => $sheetRow->toArray(null, $import instanceof WithCalculatedFormulas, $import instanceof WithFormatData, $endColumn)];
|
||||
|
||||
try {
|
||||
@@ -322,12 +324,11 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
* @param int|null $startRow
|
||||
* @param null $nullValue
|
||||
* @param bool $calculateFormulas
|
||||
* @param bool $formatData
|
||||
*
|
||||
* @param object $import
|
||||
* @param int|null $startRow
|
||||
* @param null $nullValue
|
||||
* @param bool $calculateFormulas
|
||||
* @param bool $formatData
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($import, int $startRow = null, $nullValue = null, $calculateFormulas = false, $formatData = false)
|
||||
@@ -336,20 +337,25 @@ class Sheet
|
||||
return [];
|
||||
}
|
||||
|
||||
$endRow = EndRowFinder::find($import, $startRow, $this->worksheet->getHighestRow());
|
||||
$headingRow = HeadingRowExtractor::extract($this->worksheet, $import);
|
||||
$endColumn = $import instanceof WithColumnLimit ? $import->endColumn() : null;
|
||||
$endRow = EndRowFinder::find($import, $startRow, $this->worksheet->getHighestRow());
|
||||
$headingRow = HeadingRowExtractor::extract($this->worksheet, $import);
|
||||
$headerIsGrouped = HeadingRowExtractor::extractGrouping($headingRow, $import);
|
||||
$endColumn = $import instanceof WithColumnLimit ? $import->endColumn() : null;
|
||||
|
||||
$rows = [];
|
||||
foreach ($this->worksheet->getRowIterator($startRow, $endRow) as $index => $row) {
|
||||
$row = new Row($row, $headingRow);
|
||||
$row = new Row($row, $headingRow, $headerIsGrouped);
|
||||
|
||||
if ($import instanceof SkipsEmptyRows && $row->isEmpty()) {
|
||||
if ($import instanceof SkipsEmptyRows && $row->isEmpty($calculateFormulas, $endColumn)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$row = $row->toArray($nullValue, $calculateFormulas, $formatData, $endColumn);
|
||||
|
||||
if ($import && method_exists($import, 'isEmptyWhen') && $import->isEmptyWhen($row)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($import instanceof WithMapping) {
|
||||
$row = $import->map($row);
|
||||
}
|
||||
@@ -369,12 +375,11 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $import
|
||||
* @param int|null $startRow
|
||||
* @param null $nullValue
|
||||
* @param bool $calculateFormulas
|
||||
* @param bool $formatData
|
||||
*
|
||||
* @param object $import
|
||||
* @param int|null $startRow
|
||||
* @param null $nullValue
|
||||
* @param bool $calculateFormulas
|
||||
* @param bool $formatData
|
||||
* @return Collection
|
||||
*/
|
||||
public function toCollection($import, int $startRow = null, $nullValue = null, $calculateFormulas = false, $formatData = false): Collection
|
||||
@@ -387,7 +392,7 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $sheetExport
|
||||
* @param object $sheetExport
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
@@ -430,8 +435,8 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FromView $sheetExport
|
||||
* @param int|null $sheetIndex
|
||||
* @param FromView $sheetExport
|
||||
* @param int|null $sheetIndex
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Reader\Exception
|
||||
*/
|
||||
@@ -453,8 +458,8 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FromQuery $sheetExport
|
||||
* @param Worksheet $worksheet
|
||||
* @param FromQuery $sheetExport
|
||||
* @param Worksheet $worksheet
|
||||
*/
|
||||
public function fromQuery(FromQuery $sheetExport, Worksheet $worksheet)
|
||||
{
|
||||
@@ -464,7 +469,7 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FromCollection $sheetExport
|
||||
* @param FromCollection $sheetExport
|
||||
*/
|
||||
public function fromCollection(FromCollection $sheetExport)
|
||||
{
|
||||
@@ -472,7 +477,7 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FromArray $sheetExport
|
||||
* @param FromArray $sheetExport
|
||||
*/
|
||||
public function fromArray(FromArray $sheetExport)
|
||||
{
|
||||
@@ -480,7 +485,7 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FromIterator $sheetExport
|
||||
* @param FromIterator $sheetExport
|
||||
*/
|
||||
public function fromIterator(FromIterator $sheetExport)
|
||||
{
|
||||
@@ -488,7 +493,7 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FromGenerator $sheetExport
|
||||
* @param FromGenerator $sheetExport
|
||||
*/
|
||||
public function fromGenerator(FromGenerator $sheetExport)
|
||||
{
|
||||
@@ -496,9 +501,9 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $rows
|
||||
* @param string|null $startCell
|
||||
* @param bool $strictNullComparison
|
||||
* @param array $rows
|
||||
* @param string|null $startCell
|
||||
* @param bool $strictNullComparison
|
||||
*/
|
||||
public function append(array $rows, string $startCell = null, bool $strictNullComparison = false)
|
||||
{
|
||||
@@ -526,22 +531,29 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $column
|
||||
* @param string $format
|
||||
* @param string $column
|
||||
* @param string $format
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
public function formatColumn(string $column, string $format)
|
||||
{
|
||||
$this->worksheet
|
||||
->getStyle($column . '1:' . $column . $this->worksheet->getHighestRow())
|
||||
->getNumberFormat()
|
||||
->setFormatCode($format);
|
||||
// If the column is a range, we wouldn't need to calculate the range.
|
||||
if (stripos($column, ':') !== false) {
|
||||
$this->worksheet
|
||||
->getStyle($column)
|
||||
->getNumberFormat()
|
||||
->setFormatCode($format);
|
||||
} else {
|
||||
$this->worksheet
|
||||
->getStyle($column . '1:' . $column . $this->worksheet->getHighestRow())
|
||||
->getNumberFormat()
|
||||
->setFormatCode($format);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $chunkSize
|
||||
*
|
||||
* @param int $chunkSize
|
||||
* @return Sheet
|
||||
*/
|
||||
public function chunkSize(int $chunkSize)
|
||||
@@ -560,7 +572,7 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Chart|Chart[] $charts
|
||||
* @param Chart|Chart[] $charts
|
||||
*/
|
||||
public function addCharts($charts)
|
||||
{
|
||||
@@ -572,7 +584,7 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BaseDrawing|BaseDrawing[] $drawings
|
||||
* @param BaseDrawing|BaseDrawing[] $drawings
|
||||
*/
|
||||
public function addDrawings($drawings)
|
||||
{
|
||||
@@ -584,8 +596,7 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $concern
|
||||
*
|
||||
* @param string $concern
|
||||
* @return string
|
||||
*/
|
||||
public function hasConcern(string $concern): string
|
||||
@@ -594,8 +605,8 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param iterable $rows
|
||||
* @param object $sheetExport
|
||||
* @param iterable $rows
|
||||
* @param object $sheetExport
|
||||
*/
|
||||
public function appendRows($rows, $sheetExport)
|
||||
{
|
||||
@@ -625,8 +636,7 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $row
|
||||
*
|
||||
* @param mixed $row
|
||||
* @return array
|
||||
*/
|
||||
public static function mapArraybleRow($row): array
|
||||
@@ -651,7 +661,6 @@ class Sheet
|
||||
|
||||
/**
|
||||
* @param $sheetImport
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getStartRow($sheetImport): int
|
||||
@@ -668,7 +677,10 @@ class Sheet
|
||||
unset($this->worksheet);
|
||||
}
|
||||
|
||||
protected function validate(WithValidation $import, int $startRow, $rows)
|
||||
/**
|
||||
* @return Collection|array
|
||||
*/
|
||||
protected function validated(WithValidation $import, int $startRow, $rows)
|
||||
{
|
||||
$toValidate = (new Collection($rows))->mapWithKeys(function ($row, $index) use ($startRow) {
|
||||
return [($startRow + $index) => $row];
|
||||
@@ -677,13 +689,17 @@ class Sheet
|
||||
try {
|
||||
app(RowValidator::class)->validate($toValidate->toArray(), $import);
|
||||
} catch (RowSkippedException $e) {
|
||||
foreach ($e->skippedRows() as $row) {
|
||||
unset($rows[$row - $startRow]);
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $lower
|
||||
* @param string $upper
|
||||
*
|
||||
* @param string $lower
|
||||
* @param string $upper
|
||||
* @return \Generator
|
||||
*/
|
||||
protected function buildColumnRange(string $lower, string $upper)
|
||||
@@ -708,8 +724,7 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $sheetExport
|
||||
*
|
||||
* @param object $sheetExport
|
||||
* @return bool
|
||||
*/
|
||||
private function hasStrictNullComparison($sheetExport): bool
|
||||
@@ -722,8 +737,7 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object|WithCustomChunkSize $export
|
||||
*
|
||||
* @param object|WithCustomChunkSize $export
|
||||
* @return int
|
||||
*/
|
||||
private function getChunkSize($export): int
|
||||
@@ -736,7 +750,7 @@ class Sheet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object|WithValidation $import
|
||||
* @param object|WithValidation $import
|
||||
* @return Closure|null
|
||||
*/
|
||||
private function getPreparationCallback($import)
|
||||
|
@@ -12,7 +12,7 @@ class DbTransactionHandler implements TransactionHandler
|
||||
private $connection;
|
||||
|
||||
/**
|
||||
* @param ConnectionInterface $connection
|
||||
* @param ConnectionInterface $connection
|
||||
*/
|
||||
public function __construct(ConnectionInterface $connection)
|
||||
{
|
||||
@@ -20,10 +20,10 @@ class DbTransactionHandler implements TransactionHandler
|
||||
}
|
||||
|
||||
/**
|
||||
* @param callable $callback
|
||||
* @param callable $callback
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Throwable
|
||||
* @return mixed
|
||||
*/
|
||||
public function __invoke(callable $callback)
|
||||
{
|
||||
|
@@ -5,8 +5,7 @@ namespace Maatwebsite\Excel\Transactions;
|
||||
class NullTransactionHandler implements TransactionHandler
|
||||
{
|
||||
/**
|
||||
* @param callable $callback
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function __invoke(callable $callback)
|
||||
|
@@ -5,8 +5,7 @@ namespace Maatwebsite\Excel\Transactions;
|
||||
interface TransactionHandler
|
||||
{
|
||||
/**
|
||||
* @param callable $callback
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function __invoke(callable $callback);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user