class OffsetPage (View source)

internal  JSON:API maintains no PHP API since its API is the HTTP API. This class may change at any time and this will break any dependencies on it.
 

Value object for containing the requested offset and page parameters.

Constants

KEY_NAME

The JSON:API pagination key name.

OFFSET_KEY

The offset key in the page parameter: page[offset].

SIZE_KEY

The size key in the page parameter: page[limit].

DEFAULT_OFFSET

Default offset.

SIZE_MAX

Max size.

Properties

protected int $offset

The offset for the query.

protected int $size

The size of the query.

Methods

__construct(int $offset, int $size)

Instantiates an OffsetPage object.

int
getOffset()

Returns the current offset.

int
getSize()

Returns the page size.

static OffsetPage
createFromQueryParameter(mixed $parameter)

Creates an OffsetPage object from a query parameter.

Details

__construct(int $offset, int $size)

Instantiates an OffsetPage object.

Parameters

int $offset

The query offset.

int $size

The query size limit.

int getOffset()

Returns the current offset.

Return Value

int

The query offset.

int getSize()

Returns the page size.

Return Value

int

The requested size of the query result.

static OffsetPage createFromQueryParameter(mixed $parameter)

Creates an OffsetPage object from a query parameter.

Parameters

mixed $parameter

The page query parameter from the Symfony request object.

Return Value

OffsetPage

An OffsetPage object with defaults.