PHP Class Tdt\Core\Pager

Author: Michiel Vancoillie ([email protected])
Author: Jan Vansteenlandt ([email protected])
显示文件 Open project: tdt/core Class Usage Examples

Protected Properties

Property Type Description
$DEFAULT_PAGE_SIZE
$PAGING_KEYWORDS

Public Methods

Method Description
buildQuerystring ( ) : string Build the query string from the request
calculateLimitAndOffset ( $limit = null ) Calculate the limit and offset based on the request string parameters.
calculatePagingHeaders ( integer $limit, integer $offset, integer $total_rows ) : array Calculate the link meta-data for paging purposes, return an array with paging information
setDefaultLimit ( $limit )

Protected Methods

Method Description
getLinkHeader ( $paging ) Provide paging headers in the response using the Link HTTP header.

Method Details

buildQuerystring() public static method

If not empty, will return &a=b&c=d
public static buildQuerystring ( ) : string
return string

calculateLimitAndOffset() public static method

Calculate the limit and offset based on the request string parameters.
public static calculateLimitAndOffset ( $limit = null )

calculatePagingHeaders() public static method

Calculate the link meta-data for paging purposes, return an array with paging information
public static calculatePagingHeaders ( integer $limit, integer $offset, integer $total_rows ) : array
$limit integer
$offset integer
$total_rows integer The total amount of objects
return array

getLinkHeader() protected static method

Provide paging headers in the response using the Link HTTP header.
protected static getLinkHeader ( $paging )

setDefaultLimit() public static method

public static setDefaultLimit ( $limit )

Property Details

$DEFAULT_PAGE_SIZE protected_oe static_oe property

protected static $DEFAULT_PAGE_SIZE

$PAGING_KEYWORDS protected_oe static_oe property

protected static $PAGING_KEYWORDS