PaginationInterface

An interface that defines methods needed to implement a pagination

A pagination is an object that takes a paginator and calculates variables to render a pagination for the paginated objects in the given paginator

Table of Contents

Methods

__construct()  : mixed
getEndRecordNumber()  : int
Must return the human readable index of the last paginated item
getFirstPageNumber()  : int
Must return the first page number, usually this will return 1
getLastPageNumber()  : int
Must return the last page number, usually this will return the total amount of pages
getNextPageNumber()  : int|null
Must return the next page number
getPreviousPageNumber()  : int|null
Must return the previous page number
getStartRecordNumber()  : int
Must return the human readable index of the first paginated item

Methods

getEndRecordNumber()

Must return the human readable index of the last paginated item

public getEndRecordNumber() : int

Example: given a set of 10 total items, 5 items per page and the current page being 2, the end record number is 10.

Page 1: Records 1-5 Page 2: Records 6-10

Return values
int

getFirstPageNumber()

Must return the first page number, usually this will return 1

public getFirstPageNumber() : int
Return values
int

getLastPageNumber()

Must return the last page number, usually this will return the total amount of pages

public getLastPageNumber() : int
Return values
int

getNextPageNumber()

Must return the next page number

public getNextPageNumber() : int|null

Is allowed to return null to indicate that there is no next page, e.g. when being on the last page

Return values
int|null

getPreviousPageNumber()

Must return the previous page number

public getPreviousPageNumber() : int|null

Is allowed to return null to indicate that there is no previous page, e.g. when being on the first page

Return values
int|null

getStartRecordNumber()

Must return the human readable index of the first paginated item

public getStartRecordNumber() : int

Example: given a set of 10 total items, 5 items per page and the current page being 2, the start record number is 6:

Page 1: Records 1-5 Page 2: Records 6-10

Return values
int

        
On this page

Search results