class Paginator

Paginating math.

Traits

Strict class for better experience.

Properties

int $page
int $base
int $itemsPerPage
int|null $itemCount

Methods

setPage(int $page)

Sets current page number.

int
getPage()

Returns current page number.

int
getFirstPage()

Returns first page number.

int|null
getLastPage()

Returns last page number.

setBase(int $base)

Sets first page (base) number.

int
getBase()

Returns first page (base) number.

int
getPageIndex()

Returns zero-based page number.

bool
isFirst()

Is the current page the first one?

bool
isLast()

Is the current page the last one?

int|null
getPageCount()

Returns the total number of pages.

setItemsPerPage(int $itemsPerPage)

Sets the number of items to display on a single page.

int
getItemsPerPage()

Returns the number of items to display on a single page.

setItemCount(int $itemCount = null)

Sets the total number of items.

int|null
getItemCount()

Returns the total number of items.

int
getOffset()

Returns the absolute index of the first item on current page.

int|null
getCountdownOffset()

Returns the absolute index of the first item on current page in countdown paging.

int
getLength()

Returns the number of items on current page.

Details

at line 52
Paginator setPage(int $page)

Sets current page number.

Parameters

int $page

Return Value

Paginator

at line 62
int getPage()

Returns current page number.

Return Value

int

at line 71
int getFirstPage()

Returns first page number.

Return Value

int

at line 80
int|null getLastPage()

Returns last page number.

Return Value

int|null

at line 90
Paginator setBase(int $base)

Sets first page (base) number.

Parameters

int $base

Return Value

Paginator

at line 100
int getBase()

Returns first page (base) number.

Return Value

int

at line 109
protected int getPageIndex()

Returns zero-based page number.

Return Value

int

at line 119
bool isFirst()

Is the current page the first one?

Return Value

bool

at line 128
bool isLast()

Is the current page the last one?

Return Value

bool

at line 137
int|null getPageCount()

Returns the total number of pages.

Return Value

int|null

at line 147
Paginator setItemsPerPage(int $itemsPerPage)

Sets the number of items to display on a single page.

Parameters

int $itemsPerPage

Return Value

Paginator

at line 157
int getItemsPerPage()

Returns the number of items to display on a single page.

Return Value

int

at line 167
Paginator setItemCount(int $itemCount = null)

Sets the total number of items.

Parameters

int $itemCount

Return Value

Paginator

at line 177
int|null getItemCount()

Returns the total number of items.

Return Value

int|null

at line 186
int getOffset()

Returns the absolute index of the first item on current page.

Return Value

int

at line 195
int|null getCountdownOffset()

Returns the absolute index of the first item on current page in countdown paging.

Return Value

int|null

at line 206
int getLength()

Returns the number of items on current page.

Return Value

int