File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
src/Picqer/Carriers/SendCloud/Query Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 1+ .DS_Store
2+ .idea
13composer.phar
24composer.lock
3- vendor /
5+ vendor /
Original file line number Diff line number Diff line change @@ -21,11 +21,11 @@ public function all($params = [], ?int $maxPages = 1): array
2121 while (true ) {
2222 $ result = $ this ->connection ()->get ($ this ->url , $ params );
2323
24- $ allRecords = array_merge ( $ allRecords , $ this ->collectionFromResult ($ result) );
24+ $ allRecords[] = $ this ->collectionFromResult ($ result );
2525
2626 if (! empty ($ result ['next ' ])) {
2727 // Get the querystring params from the next url, so we can retrieve the next page
28- $ params = parse_url ($ result ['next ' ], PHP_URL_QUERY );
28+ $ params = \ parse_url ($ result ['next ' ], PHP_URL_QUERY );
2929 } else {
3030 // If no next page is found, all records are complete
3131 break ;
@@ -34,12 +34,12 @@ public function all($params = [], ?int $maxPages = 1): array
3434 $ pages ++;
3535
3636 // If max pages is set and reached, also stop the loop
37- if (! is_null ( $ maxPages) && $ pages >= $ maxPages ) {
37+ if (null !== $ maxPages && $ pages >= $ maxPages ) {
3838 break ;
3939 }
4040 }
4141
42- return $ allRecords ;
42+ return \array_merge (... $ allRecords) ;
4343 }
4444
4545 public function collectionFromResult ($ result ): array
You can’t perform that action at this time.
0 commit comments