Paginator
abstract class Paginator implements Countable, Iterator
Properties
| protected int | $pageNumber | The page number applied to the next request. |
|
| protected int | $currentPage | The zero-based iterator position. |
|
| protected int | $startPage | The first page number requested after rewind. |
|
| protected int|null | $maxPages | The optional maximum number of pages to request. |
|
| protected int|null | $perPageLimit | The optional result limit per page. |
|
| protected null|Response<mixed> | $currentResponse | The current response. |
|
| protected bool | $currentPageLoaded | Whether the current page has been fetched and mapped. |
|
| protected TItem> | $currentPageItems | The items mapped from the final current response. |
|
| protected int | $totalResults | The total number of mapped results processed. |
|
| protected bool | $detectInfiniteLoop | Whether repeated response bodies should stop iteration. |
|
| protected bool | $pooling | Whether the paginator is currently preparing pooled pages. |
|
| protected array<int, string> | $lastFiveBodyChecksums | The latest response body checksums. |
Methods
Move to the next page.
Get the current iterator key.
Determine if another page should be requested.
Reset all iterator state.
Process extra state when the paginator rewinds.
Iterate over every response item.
Create a lazy collection from page responses or response items.
Send every page through a bounded coroutine pool.
Get the total number of processed results.
Set the number of results requested per page.
Get the current zero-based page position.
Count the number of pages yielded by the iterator.
Yield independently addressable page requests after the first page.
Details
at line 141
Response
current()
Get the response for the current page.
at line 162
void
next()
Move to the next page.
at line 173
int
key()
Get the current iterator key.
at line 181
bool
valid()
Determine if another page should be requested.
at line 193
void
rewind()
Reset all iterator state.
at line 208
protected void
onRewind()
Process extra state when the paginator rewinds.
at line 217
iterable
items()
Iterate over every response item.
at line 231
LazyCollection
collect(bool $throughItems = true)
Create a lazy collection from page responses or response items.
at line 245
array
pool(int $concurrency = 5, callable|null $responseHandler = null, callable|null $exceptionHandler = null)
Send every page through a bounded coroutine pool.
at line 322
int
totalResults()
Get the total number of processed results.
at line 332
Paginator
maxPages(int|null $maxPages)
Set the maximum number of pages to request.
at line 344
Paginator
perPageLimit(int|null $perPageLimit)
Set the number of results requested per page.
at line 356
Request
request()
Get the cloned request used by this paginator.
at line 364
int
currentPage()
Get the current zero-based page position.
at line 374
Paginator
startPage(int $startPage)
Set the first page number requested after rewind.
at line 384
int
count()
Count the number of pages yielded by the iterator.
at line 403
protected array
pageItems(Response $response)
Resolve response items using the request override when present.
at line 420
protected iterable
remainingRequests(int $lastPage)
Yield independently addressable page requests after the first page.
at line 435
protected int
getTotalPages(Response $response)
Get the total number of independently addressable pages.
at line 446
abstract protected Request
applyPagination(Request $request)
Apply pagination to a cloned request.
at line 453
abstract protected bool
isLastPage(Response $response)
Determine if the response is the last page.