PHP Class seregazhuk\PinterestBot\Helpers\Pagination

Inheritance: implements IteratorAggregate
Exibir arquivo Open project: seregazhuk/php-pinterest-bot Class Usage Examples

Protected Properties

Property Type Description
$bookmarks array
$callback callable
$limit integer
$offset integer

Public Methods

Method Description
__construct ( integer $limit = self::DEFAULT_LIMIT )
get ( ) : Traversable Syntax sugar for getIterator method
getIterator ( ) : Traversable Retrieve an external iterator
paginateOver ( callable $callback ) Sets a callback to make requests. Should be a closure that accepts a $bookmarks array as an argument.
skip ( integer $offset )
take ( integer $limit )
toArray ( ) : array

Protected Methods

Method Description
checkEndBookMarks ( ) : boolean Checks for -end- substring in bookmarks. This is pinterest sign of the finished pagination.
getCurrentResults ( ) : array
paginationFinished ( integer $resultsNum ) : boolean
processResponse ( seregazhuk\PinterestBot\Api\Contracts\PaginatedResponse $response ) : array
reachesLimit ( integer $resultsNum ) : boolean Check if we get results limit in pagination.

Method Details

__construct() public method

public __construct ( integer $limit = self::DEFAULT_LIMIT )
$limit integer

checkEndBookMarks() protected method

Checks for -end- substring in bookmarks. This is pinterest sign of the finished pagination.
protected checkEndBookMarks ( ) : boolean
return boolean

get() public method

Syntax sugar for getIterator method
public get ( ) : Traversable
return Traversable

getCurrentResults() protected method

protected getCurrentResults ( ) : array
return array

getIterator() public method

Retrieve an external iterator
public getIterator ( ) : Traversable
return Traversable

paginateOver() public method

Sets a callback to make requests. Should be a closure that accepts a $bookmarks array as an argument.
public paginateOver ( callable $callback )
$callback callable

paginationFinished() protected method

protected paginationFinished ( integer $resultsNum ) : boolean
$resultsNum integer
return boolean

processResponse() protected method

protected processResponse ( seregazhuk\PinterestBot\Api\Contracts\PaginatedResponse $response ) : array
$response seregazhuk\PinterestBot\Api\Contracts\PaginatedResponse
return array

reachesLimit() protected method

Check if we get results limit in pagination.
protected reachesLimit ( integer $resultsNum ) : boolean
$resultsNum integer
return boolean

skip() public method

public skip ( integer $offset )
$offset integer

take() public method

public take ( integer $limit )
$limit integer

toArray() public method

public toArray ( ) : array
return array

Property Details

$bookmarks protected_oe property

protected array $bookmarks
return array

$callback protected_oe property

protected callable $callback
return callable

$limit protected_oe property

protected int $limit
return integer

$offset protected_oe property

protected int $offset
return integer