class CursorPaginator

Methods

__construct(Collection $items, int $perPage = 10, string|null $cursor = null)

Create a paginator for the supplied items.

array
paginate(string $key = 'items')

Return the current page and its continuation cursor.

int
getStartOffsetFromCursor()

Decode the starting offset from the cursor.

string
createCursor(int $offset)

Encode a continuation offset.

Details

at line 17
__construct(Collection $items, int $perPage = 10, string|null $cursor = null)

Create a paginator for the supplied items.

Parameters

Collection $items
int $perPage
string|null $cursor

at line 31
array paginate(string $key = 'items')

Return the current page and its continuation cursor.

Parameters

string $key

Return Value

array

at line 51
protected int getStartOffsetFromCursor()

Decode the starting offset from the cursor.

Return Value

int

at line 75
protected string createCursor(int $offset)

Encode a continuation offset.

Parameters

int $offset

Return Value

string