1 | <?php |
||
10 | final class CallbackPage implements Page |
||
11 | { |
||
12 | private $resultCallback; |
||
13 | private $totalCountCallback; |
||
14 | private $offset; |
||
15 | private $limit; |
||
16 | private $totalCount; |
||
17 | private $results; |
||
18 | |||
19 | /** |
||
20 | * @param callable $resultCallback Returns an array |
||
21 | * @param callable $totalCountCallback Returns an integer |
||
22 | * @param int $offset |
||
23 | * @param int $limit |
||
24 | */ |
||
25 | 16 | public function __construct(callable $resultCallback, callable $totalCountCallback, $offset, $limit) |
|
32 | |||
33 | /** |
||
34 | * {@inheritdoc} |
||
35 | */ |
||
36 | 8 | public function getCurrentOffset() |
|
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | 8 | public function getCurrentPage() |
|
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | */ |
||
52 | 8 | public function getCurrentLimit() |
|
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | */ |
||
60 | 16 | public function count() |
|
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | 4 | public function totalCount() |
|
76 | |||
77 | /** |
||
78 | * {@inheritdoc} |
||
79 | */ |
||
80 | 8 | public function getIterator() |
|
84 | |||
85 | /** |
||
86 | * @return \ArrayIterator |
||
87 | */ |
||
88 | 16 | private function getResults() |
|
96 | } |
||
97 |