LinkPaginator
abstract class LinkPaginator extends PagedPaginator
Properties
| protected int | $pageNumber | The page number applied to the next request. |
from Paginator |
| protected int | $currentPage | The zero-based iterator position. |
from Paginator |
| protected int | $startPage | The first page number requested after rewind. |
from Paginator |
| protected int|null | $maxPages | The optional maximum number of pages to request. |
from Paginator |
| protected int|null | $perPageLimit | The optional result limit per page. |
from Paginator |
| protected null|Response<mixed> | $currentResponse | The current response. |
from Paginator |
| protected bool | $currentPageLoaded | Whether the current page has been fetched and mapped. |
from Paginator |
| protected TItem> | $currentPageItems | The items mapped from the final current response. |
from Paginator |
| protected int | $totalResults | The total number of mapped results processed. |
from Paginator |
| protected bool | $detectInfiniteLoop | Whether repeated response bodies should stop iteration. |
from Paginator |
| protected bool | $checksumIncludesContinuation | Whether page checksums include the provider's continuation, so a repeated checksum repeats an earlier request. |
|
| protected bool | $pooling | Whether the paginator is currently preparing pooled pages. |
from Paginator |
| protected array<int, string> | $lastFiveBodyChecksums | The latest response checksums, including continuation where available. |
from Paginator |
| protected string | $pageName | The page-number query parameter. |
from PagedPaginator |
| protected string | $perPageName | The per-page limit query parameter. |
from PagedPaginator |
| protected UriInterface|null | $nextUri | The next page's resolved URI. |
|
| protected int|null | $lastPage | The last independently addressable page for pooled requests. |
Methods
Clear continuation state when iteration restarts.
Create a lazy collection from page responses or response items.
Send every page through a bounded coroutine pool.
Set the number of results requested per page.
Compare page contents together with the provider's continuation URL.
Yield independently addressable page requests after the first page.
Read an optional page number without flattening repeated names.
Resolve a continuation target against the current request.
Details
at line 41
Response
current()
Get the current response and resolve its pagination links.
in
Paginator at line 179
void
next()
Move to the next page.
in
Paginator at line 190
int
key()
Get the current iterator key.
in
Paginator at line 198
bool
valid()
Determine if another page should be requested.
in
Paginator at line 210
void
rewind()
Reset all iterator state.
at line 130
protected void
onRewind()
Clear continuation state when iteration restarts.
in
Paginator at line 234
iterable
items()
Iterate over every response item.
in
Paginator at line 248
LazyCollection
collect(bool $throughItems = true)
Create a lazy collection from page responses or response items.
in
Paginator at line 262
array
pool(int $concurrency = 5, callable|null $responseHandler = null, callable|null $exceptionHandler = null)
Send every page through a bounded coroutine pool.
in
Paginator at line 341
int
totalResults()
Get the total number of processed results.
in
Paginator at line 351
Paginator
maxPages(int|null $maxPages)
Set the maximum number of pages to request.
in
Paginator at line 363
Paginator
perPageLimit(int|null $perPageLimit)
Set the number of results requested per page.
in
Paginator at line 383
int
currentPage()
Get the current zero-based page position.
in
Paginator at line 393
Paginator
startPage(int $startPage)
Set the first page number requested after rewind.
in
Paginator at line 403
int
count()
Count the number of pages yielded by the iterator.
at line 68
protected string
getPageChecksum(Response $response)
Compare page contents together with the provider's continuation URL.
in
Paginator at line 431
protected string
getBodyChecksum(Response $response)
Get the checksum of the response body.
in
Paginator at line 442
protected array
pageItems(Response $response)
Resolve response items using the request override when present.
in
Paginator at line 459
protected iterable
remainingRequests(int $lastPage)
Yield independently addressable page requests after the first page.
at line 120
protected int
getTotalPages(Response $response)
Resolve the last independently addressable page.
at line 82
protected Request
applyPagination(Request $request)
Apply numbered pagination or the provider's continuation URL.
at line 110
protected bool
isLastPage(Response $response)
Determine whether the response has no continuation link.
in
Paginator at line 501
abstract protected array
getPageItems(Response $response, Request $request)
Get the items from one page.
at line 98
protected Request
applyNextLink(Request $request)
Apply the continuation URL and replace any explicit raw query.
at line 139
protected int|null
pageFromUri(UriInterface $uri)
Read an optional page number without flattening repeated names.
at line 160
protected UriInterface
resolveLink(string $target, UriInterface $currentUri)
Resolve a continuation target against the current request.
at line 180
abstract protected array
getLinks(Response $response, UriInterface $currentUri)
Get pagination links resolved through resolveLink against the current URI.