Copied!

PaginationInput

PaginationInput.php : 29
Read-only

Page of a list tool's result to return, shared by all paginated tools.

Declare it as an optional tool parameter, PaginationInput $pagination = new PaginationInput(), and return a subclass of AbstractPaginatedResult. The JSON schema of the argument is generated from this class and the argument is validated against its constraints.

A tool needing other bounds uses a subclass of this class instead:

  • another default limit: redeclare the constructor with another default for $limit and pass it on to the parent constructor,
  • another maximum limit: override getMaxLimit().

Descriptions are kept in the property docblocks, so subclasses inherit them.

Tags
Experimental

Constants

publicDEFAULT_LIMIT

PaginationInput.php : 31
public int DEFAULT_LIMIT = 25

publicMAX_LIMIT

PaginationInput.php : 32
public int MAX_LIMIT = 100

Properties

public $limit

PaginationInput.php : 36

Maximum number of items to return. Every page except the last one holds exactly this number of items.

public int $limit = self::DEFAULT_LIMIT
Attributes
#[Range]
$min: 1
$maxPropertyPath: 'maxLimit'

public $offset

PaginationInput.php : 39

Number of items to skip from the start of the full result. 0 returns the first page.

public int $offset = 0
Attributes
#[Range]
$min: 0

Methods

public__construct()

PaginationInput.php : 34
public __construct([int $limit = \self::DEFAULT_LIMIT ][, int $offset = 0 ])

Parameters

Name Type Default value Description
$limit int PaginationInput::DEFAULT_LIMIT -
$offset int 0 -

publicgetMaxLimit()

PaginationInput.php : 49

Upper bound of the limit.

public getMaxLimit() : int

It is also read without a constructed instance to build the JSON schema, so an override must not depend on the instance state (return a constant).

Return values

int