1 | <?php |
||
5 | final class Iterator implements \Iterator, \Countable |
||
6 | { |
||
7 | |||
8 | /** |
||
9 | * @var int |
||
10 | */ |
||
11 | private $position = 0; |
||
12 | |||
13 | /** |
||
14 | * @var AbstractCollection |
||
15 | */ |
||
16 | private $data; |
||
17 | |||
18 | 12 | public function __construct(AbstractCollection $collection) |
|
22 | |||
23 | /** |
||
24 | * @return mixed |
||
25 | */ |
||
26 | 2 | public function current() |
|
30 | |||
31 | /** |
||
32 | * @inheritDoc |
||
33 | */ |
||
34 | 6 | public function next() |
|
38 | |||
39 | /** |
||
40 | * @return int |
||
41 | */ |
||
42 | 1 | public function key() : int |
|
46 | |||
47 | /** |
||
48 | * @return bool |
||
49 | */ |
||
50 | 2 | public function valid() : bool |
|
54 | |||
55 | /** |
||
56 | * @return int |
||
57 | */ |
||
58 | 3 | public function count() : int |
|
62 | |||
63 | /** |
||
64 | * @inheritDoc |
||
65 | */ |
||
66 | 1 | public function rewind() |
|
70 | } |
||
71 |