class Paginator implements PaginatorInterface

Paginator base class

Constants

UNKNOWN

DEFAULT_PER_PAGE

CARD_VIEW

TABLE_VIEW

GRID_VIEW

Properties

protected array $items Paginator items
protected integer $currentPage Current page
protected integer $lastPage Last page
protected integer $perPage Row per page value
protected integer $total Total number of items before slice

Methods

__construct(int $currentPage = 1, array $items = [], int $perPage = Self::DEFAULT_PER_PAGE, int $lastPage = 1, int $total = 1)

Constructor

mixed
getItems()

Return items

int
getCurrentPage()

Get current page

mixed
getFirstItem()

Get first item

int
getTotalItems()

Get total items

mixed
getLastItem()

Get last item

int
getLastPage()

Get last page

int
getPerPage()

Get rows per page

int
getItemsCount()

Return items count

array
toArray()

Convert paginator data to array

array
getPaginatorData()

Get paginator data

create(object|array|string $source, int $page = 1, int $perPage = Self::DEFAULT_PER_PAGE)

Create paginator

array
sliceItems(array $items)

Slice array items

int
calcLastPage()

Calc last page

Details

at line 74
__construct(int $currentPage = 1, array $items = [], int $perPage = Self::DEFAULT_PER_PAGE, int $lastPage = 1, int $total = 1)

Constructor

Parameters

int $currentPage
array $items
int $perPage
int $lastPage
int $total

at line 94
mixed getItems()

Return items

Return Value

mixed

at line 104
int getCurrentPage()

Get current page

Return Value

int

at line 121
mixed getFirstItem()

Get first item

Return Value

mixed

at line 131
int getTotalItems()

Get total items

Return Value

int

at line 141
mixed getLastItem()

Get last item

Return Value

mixed

at line 151
int getLastPage()

Get last page

Return Value

int

at line 161
int getPerPage()

Get rows per page

Return Value

int

at line 171
int getItemsCount()

Return items count

Return Value

int

at line 181
array toArray()

Convert paginator data to array

Return Value

array

at line 194
array getPaginatorData()

Get paginator data

Return Value

array

at line 212
static PaginatorInterface create(object|array|string $source, int $page = 1, int $perPage = Self::DEFAULT_PER_PAGE)

Create paginator

Parameters

object|array|string $source
int $page
int $perPage

Return Value

PaginatorInterface

at line 253
protected array sliceItems(array $items)

Slice array items

Parameters

array $items

Return Value

array

at line 265
protected int calcLastPage()

Calc last page

Return Value

int