| 1 | <?php |
||
| 5 | class PaginationHelper |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Iterate through results of Api function call. By |
||
| 9 | * default generator will return all pagination results. |
||
| 10 | * To limit result batches, set $batchesLimit. Call function |
||
| 11 | * of object to get data. |
||
| 12 | * |
||
| 13 | * @param mixed $obj |
||
| 14 | * @param string $function |
||
| 15 | * @param array $params |
||
| 16 | * @param int $batchesLimit |
||
| 17 | * @return \Iterator |
||
| 18 | */ |
||
| 19 | public static function getPaginatedData($obj, $function, $params, $batchesLimit = 0) |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @param array $res |
||
| 48 | * @return bool |
||
| 49 | */ |
||
| 50 | protected static function _responseHasData($res) |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Check if we get batches limit in pagination |
||
| 57 | * @param int $batchesLimit |
||
| 58 | * @param int $batchesNum |
||
| 59 | * @return bool |
||
| 60 | */ |
||
| 61 | protected static function reachBatchesLimit($batchesLimit, $batchesNum) |
||
| 65 | } |
||
| 66 |