abstract class LinkHeaderPaginator extends LinkPaginator

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 $pooling

Whether the paginator is currently preparing pooled pages.

from  Paginator
protected array<int, string> $lastFiveBodyChecksums

The latest response body checksums.

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.

from  LinkPaginator
protected int|null $lastPage

The last independently addressable page for pooled requests.

from  LinkPaginator
protected string $nextRelation

The relation identifying the next page.

protected string $lastRelation

The relation identifying the last page.

Methods

__construct(Connector $connector, Request $request)

Create a paginator.

current()

Get the current response and resolve its pagination links.

void
next()

Move to the next page.

int
key()

Get the current iterator key.

bool
valid()

Determine if another page should be requested.

void
rewind()

Reset all iterator state.

void
onRewind()

Clear continuation state when iteration restarts.

iterable
items()

Iterate over every response item.

collect(bool $throughItems = true)

Create a lazy collection from page responses or response items.

array
pool(int $concurrency = 5, callable|null $responseHandler = null, callable|null $exceptionHandler = null)

Send every page through a bounded coroutine pool.

int
totalResults()

Get the total number of processed results.

maxPages(int|null $maxPages)

Set the maximum number of pages to request.

perPageLimit(int|null $perPageLimit)

Set the number of results requested per page.

request()

Get the cloned request used by this paginator.

int
currentPage()

Get the current zero-based page position.

startPage(int $startPage)

Set the first page number requested after rewind.

int
count()

Count the number of pages yielded by the iterator.

array
pageItems(Response $response)

Resolve response items using the request override when present.

iterable
remainingRequests(int $lastPage)

Yield independently addressable page requests after the first page.

int
getTotalPages(Response $response)

Resolve the last independently addressable page.

applyPagination(Request $request)

Apply numbered pagination or the provider's continuation URL.

bool
isLastPage(Response $response)

Determine whether the response has no continuation link.

array
getPageItems(Response $response, Request $request)

Get the items from one page.

applyNextLink(Request $request)

Apply the continuation URL and replace any explicit raw query.

int|null
pageFromUri(UriInterface $uri)

Read an optional page number without flattening repeated names.

UriInterface
resolveLink(string $target, UriInterface $currentUri)

Resolve a continuation target against the current request.

array
getLinks(Response $response, UriInterface $currentUri)

Get the next and last page links from the response headers.

array
parseLinks(array $headers, UriInterface $currentUri)

Parse pagination relations without splitting quoted values or URI commas.

Details

in Paginator at line 100
__construct(Connector $connector, Request $request)

Create a paginator.

Parameters

Connector $connector
Request $request

in LinkPaginator at line 36
Response current()

Get the current response and resolve its pagination links.

Return Value

Response

in Paginator at line 162
void next()

Move to the next page.

Return Value

void

in Paginator at line 173
int key()

Get the current iterator key.

Return Value

int

in Paginator at line 181
bool valid()

Determine if another page should be requested.

Return Value

bool

in Paginator at line 193
void rewind()

Reset all iterator state.

Return Value

void

in LinkPaginator at line 112
protected void onRewind()

Clear continuation state when iteration restarts.

Return Value

void

in Paginator at line 217
iterable items()

Iterate over every response item.

Return Value

iterable

in Paginator at line 231
LazyCollection collect(bool $throughItems = true)

Create a lazy collection from page responses or response items.

Parameters

bool $throughItems

Return Value

LazyCollection

in Paginator at line 245
array pool(int $concurrency = 5, callable|null $responseHandler = null, callable|null $exceptionHandler = null)

Send every page through a bounded coroutine pool.

Parameters

int $concurrency
callable|null $responseHandler
callable|null $exceptionHandler

Return Value

array

in Paginator at line 322
int totalResults()

Get the total number of processed results.

Return Value

int

in Paginator at line 332
Paginator maxPages(int|null $maxPages)

Set the maximum number of pages to request.

Parameters

int|null $maxPages

Return Value

Paginator

in Paginator at line 344
Paginator perPageLimit(int|null $perPageLimit)

Set the number of results requested per page.

Parameters

int|null $perPageLimit

Return Value

Paginator

in Paginator at line 356
Request request()

Get the cloned request used by this paginator.

Return Value

Request

in Paginator at line 364
int currentPage()

Get the current zero-based page position.

Return Value

int

in Paginator at line 374
Paginator startPage(int $startPage)

Set the first page number requested after rewind.

Parameters

int $startPage

Return Value

Paginator

in Paginator at line 384
int count()

Count the number of pages yielded by the iterator.

Return Value

int

in Paginator at line 403
protected array pageItems(Response $response)

Resolve response items using the request override when present.

Parameters

Response $response

Return Value

array

in Paginator at line 420
protected iterable remainingRequests(int $lastPage)

Yield independently addressable page requests after the first page.

Parameters

int $lastPage

Return Value

iterable

in LinkPaginator at line 102
protected int getTotalPages(Response $response)

Resolve the last independently addressable page.

Parameters

Response $response

Return Value

int

in LinkPaginator at line 64
protected Request applyPagination(Request $request)

Apply numbered pagination or the provider's continuation URL.

Parameters

Request $request

Return Value

Request

in LinkPaginator at line 92
protected bool isLastPage(Response $response)

Determine whether the response has no continuation link.

Parameters

Response $response

Return Value

bool

in Paginator at line 462
abstract protected array getPageItems(Response $response, Request $request)

Get the items from one page.

Parameters

Response $response
Request $request

Return Value

array

Apply the continuation URL and replace any explicit raw query.

Parameters

Request $request

Return Value

Request

in LinkPaginator at line 121
protected int|null pageFromUri(UriInterface $uri)

Read an optional page number without flattening repeated names.

Parameters

UriInterface $uri

Return Value

int|null

Resolve a continuation target against the current request.

Parameters

string $target
UriInterface $currentUri

Return Value

UriInterface

Get the next and last page links from the response headers.

Parameters

Response $response
UriInterface $currentUri

Return Value

array

Parse pagination relations without splitting quoted values or URI commas.

Parameters

array $headers
UriInterface $currentUri

Return Value

array