1 | <?php |
||
5 | class PagingIterator implements \Iterator, \Countable |
||
6 | { |
||
7 | /** @var callable */ |
||
8 | protected $generator; |
||
9 | |||
10 | /** @var array */ |
||
11 | protected $args; |
||
12 | |||
13 | /** @var int */ |
||
14 | protected $page; |
||
15 | |||
16 | /** @var array */ |
||
17 | protected $query; |
||
18 | |||
19 | /** @var ResourceCollection */ |
||
20 | protected $resourceCollection; |
||
21 | |||
22 | /** |
||
23 | * @param callable $generator |
||
24 | * @param int $page |
||
25 | * @param array $query |
||
26 | * |
||
27 | * @throws \InvalidArgumentException when generator is not callable |
||
28 | */ |
||
29 | public function __construct($generator, $page, array $query = []) |
||
45 | |||
46 | protected function reset() |
||
52 | |||
53 | /** {@inheritdoc} */ |
||
54 | public function current() |
||
58 | |||
59 | /** {@inheritdoc} */ |
||
60 | public function key() |
||
64 | |||
65 | /** {@inheritdoc} */ |
||
66 | public function next() |
||
72 | |||
73 | /** {@inheritdoc} */ |
||
74 | public function valid() |
||
80 | |||
81 | /** {@inheritdoc} */ |
||
82 | public function rewind() |
||
86 | |||
87 | /** {@inheritdoc} */ |
||
88 | public function count() |
||
92 | |||
93 | protected function loadIfNecessary() |
||
109 | |||
110 | /** |
||
111 | * @return bool |
||
112 | */ |
||
113 | protected function isLoadNecessary() |
||
117 | } |
||
118 |