File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,25 @@ public function getPreviousPage(): ?static
114114 return $ this ->getOffset ($ this ->getPreviousOffset ());
115115 }
116116
117-
117+ /**
118+ * Get all results from this page and all following pages.
119+ * This will request each page from the api one by one.
120+ *
121+ * When called on the first page this will return all results.
122+ *
123+ * @throws ApiException
124+ * @return T[]
125+ */
126+ public function getResultsFromFollowingPages (): array
127+ {
128+ $ results = $ this ->getResults ();
129+ $ nextPage = $ this ->getNextPage ();
130+ while ($ nextPage !== null ) {
131+ array_push ($ results , ...$ nextPage ->getResults ());
132+ $ nextPage = $ nextPage ->getNextPage ();
133+ }
134+ return $ results ;
135+ }
118136
119137 /**
120138 * @inheritDoc
You can’t perform that action at this time.
0 commit comments