JsonPaginator
extends ArrayPaginator
in package
implements
PaginatorInterface
Paginate Josn
Table of Contents
Interfaces
- PaginatorInterface
- Paginator interface
Constants
- CARD_VIEW = 'card'
- DEFAULT_PER_PAGE = 25
- GRID_VIEW = 'grid'
- TABLE_VIEW = 'table'
- UNKNOWN = -1
Properties
- $currentPage : int
- Current page
- $items : array<string|int, mixed>|mixed
- Paginator items
- $lastPage : int
- Last page
- $perPage : int
- Row per page value
- $total : int
- Total number of items before slice
Methods
- __construct() : mixed
- Constructor
- create() : PaginatorInterface
- Create paginator
- getCurrentPage() : int
- Get current page
- getFirstItem() : mixed
- Get first item
- getItems() : mixed
- Return items
- getItemsCount() : int
- Return items count
- getLastItem() : mixed
- Get last item
- getLastPage() : int
- Get last page
- getPaginatorData() : array<string|int, mixed>
- Get paginator data
- getPerPage() : int
- Get rows per page
- getTotalItems() : int
- Get total items
- toArray() : array<string|int, mixed>
- Convert paginator data to array
- calcLastPage() : int
- Calc last page
- sliceItems() : array<string|int, mixed>
- Slice array items
Constants
CARD_VIEW
public
mixed
CARD_VIEW
= 'card'
DEFAULT_PER_PAGE
public
mixed
DEFAULT_PER_PAGE
= 25
GRID_VIEW
public
mixed
GRID_VIEW
= 'grid'
TABLE_VIEW
public
mixed
TABLE_VIEW
= 'table'
UNKNOWN
public
mixed
UNKNOWN
= -1
Properties
$currentPage
Current page
protected
int
$currentPage
$items
Paginator items
protected
array<string|int, mixed>|mixed
$items
$lastPage
Last page
protected
int
$lastPage
$perPage
Row per page value
protected
int
$perPage
= Self::DEFAULT_PER_PAGE
$total
Total number of items before slice
protected
int
$total
Methods
__construct()
Constructor
public
__construct(string $json[, int $page = 1 ][, int $perPage = Paginator::DEFAULT_PER_PAGE ]) : mixed
Parameters
- $json : string
- $page : int = 1
- $perPage : int = Paginator::DEFAULT_PER_PAGE
create()
Create paginator
public
static create(object|array<string|int, mixed>|string $source[, int $page = 1 ][, int|null $perPage = Self::DEFAULT_PER_PAGE ]) : PaginatorInterface
Parameters
- $source : object|array<string|int, mixed>|string
- $page : int = 1
- $perPage : int|null = Self::DEFAULT_PER_PAGE
Return values
PaginatorInterfacegetCurrentPage()
Get current page
public
getCurrentPage() : int
Return values
intgetFirstItem()
Get first item
public
getFirstItem() : mixed
getItems()
Return items
public
getItems() : mixed
getItemsCount()
Return items count
public
getItemsCount() : int
Return values
intgetLastItem()
Get last item
public
getLastItem() : mixed
getLastPage()
Get last page
public
getLastPage() : int
Return values
intgetPaginatorData()
Get paginator data
public
getPaginatorData() : array<string|int, mixed>
Return values
array<string|int, mixed>getPerPage()
Get rows per page
public
getPerPage() : int
Return values
intgetTotalItems()
Get total items
public
getTotalItems() : int
Return values
inttoArray()
Convert paginator data to array
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>calcLastPage()
Calc last page
protected
calcLastPage() : int
Return values
intsliceItems()
Slice array items
protected
sliceItems(array<string|int, mixed> $items) : array<string|int, mixed>
Parameters
- $items : array<string|int, mixed>