| 1 | <?php |
||
| 5 | class Paginator |
||
| 6 | { |
||
| 7 | protected $page; |
||
| 8 | protected $limit; |
||
| 9 | protected $results = []; |
||
| 10 | protected $hasMore = true; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @param int $pageStart |
||
| 14 | * @param int $limit |
||
| 15 | */ |
||
| 16 | public function __construct($pageStart = 0, $limit = 500) |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @return array |
||
| 24 | */ |
||
| 25 | public function getResults() |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param array $results |
||
| 32 | */ |
||
| 33 | public function addResults(array $results) |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @return bool |
||
| 44 | */ |
||
| 45 | public function hasMore() |
||
| 49 | |||
| 50 | public function nextPage() |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @return int |
||
| 63 | */ |
||
| 64 | public function getPage() |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @return int |
||
| 71 | */ |
||
| 72 | public function getLimit() |
||
| 76 | } |
||
| 77 |