From 0e0bbbc747e5cdc157d9e32e74511ef14d5b6c9c Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Fri, 9 Dec 2022 14:03:00 +0100 Subject: [PATCH] Allow to pass params to autoPagingIterator method --- lib/Collection.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Collection.php b/lib/Collection.php index 67da085d3..84f7ab229 100644 --- a/lib/Collection.php +++ b/lib/Collection.php @@ -165,12 +165,14 @@ public function getReverseIterator() } /** + * @param null|array $params + * * @return \Generator|TStripeObject[] A generator that can be used to * iterate across all objects across all pages. As page boundaries are * encountered, the next page will be fetched automatically for * continued iteration. */ - public function autoPagingIterator() + public function autoPagingIterator($params = null) { $page = $this; @@ -181,12 +183,12 @@ public function autoPagingIterator() foreach ($page->getReverseIterator() as $item) { yield $item; } - $page = $page->previousPage(); + $page = $page->previousPage($params); } else { foreach ($page as $item) { yield $item; } - $page = $page->nextPage(); + $page = $page->nextPage($params); } if ($page->isEmpty()) {