Skip to content

Commit eada019

Browse files
Merge pull request #11 from bayareawebpro/dev
Dev
2 parents c92796b + 6042c1a commit eada019

File tree

5 files changed

+10
-12
lines changed

5 files changed

+10
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,4 @@ etc...
108108
- Using Lazy Collections is the preferred method.
109109
- Using the queue worker, you can import a several thousand rows at a time without much impact.
110110
- Be sure to use "Database Transactions" and "Timeout Detection" to insure safe imports.
111-
- [Article: How to Insert & Update Many at Once](https://medium.com/@danielalvidrez/laravel-query-builder-macros-fe176d34135e)
111+
- [Article: How to Insert & Update Many at Once](https://medium.com/@danielalvidrez/laravel-query-builder-macros-fe176d34135e)

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
}
1010
],
1111
"require": {
12-
"php": "^7.2.5",
12+
"php": "^7.2|^8.0",
1313
"illuminate/support": "^6.0|^7.0|^8.0"
1414
},
1515
"require-dev": {
16-
"orchestra/testbench": "^4.0",
17-
"phpunit/phpunit": "^8.0",
18-
"nunomaduro/larastan": "^0.4.2"
16+
"orchestra/testbench": "^4.0|^5.0|^6.0",
17+
"phpunit/phpunit": "^8.0|^9.0",
18+
"nunomaduro/larastan": "^0.6"
1919
},
2020
"autoload": {
2121
"psr-4": {

phpunit.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
</whitelist>
2121
</filter>
2222
<logging>
23-
<log type="tap" target="build/report.tap"/>
2423
<log type="junit" target="build/report.junit.xml"/>
25-
<log type="coverage-clover" target="clover.xml"/>
24+
<log type="coverage-clover" target="build/clover.xml"/>
2625
</logging>
2726
<php>
2827
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsm1"/>

src/SimpleCsv.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
/**
88
* The SimpleCsv Service Facade
9-
* @method static \Symfony\Component\HttpFoundation\StreamedResponse download(Collection|LazyCollection|\Iterator|\Generator|array $collection, string $filename)
10-
* @method static void export(Collection|LazyCollection|\Iterator|\Generator|array $collection, string $path)
9+
* @method static \Symfony\Component\HttpFoundation\StreamedResponse download(Collection|LazyCollection|\Iterator|array $collection, string $filename)
10+
* @method static void export(Collection|LazyCollection|\Iterator|array $collection, string $path)
1111
* @method static LazyCollection import(string $path)
1212
*/
1313
class SimpleCsv extends LaravelFacade

src/SimpleCsvService.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
namespace BayAreaWebPro\SimpleCsv;
44

55
use Iterator;
6-
use Generator;
76
use SplFileObject;
87
use Illuminate\Support\Collection;
98
use Illuminate\Support\LazyCollection;
109
use Symfony\Component\HttpFoundation\StreamedResponse;
10+
1111
class SimpleCsvService
1212
{
1313
const DELIMITER = ',';
@@ -92,7 +92,7 @@ protected function writeLine(array $line): void
9292

9393
protected function flattenRow($entry): array
9494
{
95-
return method_exists($entry, 'toArray') ? $entry->toArray() : (array)$entry;
95+
return is_object($entry) && method_exists($entry, 'toArray') ? $entry->toArray() : (array)$entry;
9696
}
9797

9898
protected function openFileObject(string $path, string $mode = 'r'): void
@@ -109,7 +109,6 @@ protected function writeLines($collection): void
109109
{
110110
if (
111111
!$collection instanceof Iterator &&
112-
!$collection instanceof Generator &&
113112
!$collection instanceof Collection &&
114113
!$collection instanceof LazyCollection &&
115114
!is_array($collection)

0 commit comments

Comments
 (0)