1 | <?php |
||
13 | class CollectionIterator extends ArrayIterator |
||
14 | { |
||
15 | /** |
||
16 | * @var Collection |
||
17 | */ |
||
18 | private $collection; |
||
19 | |||
20 | private $data = []; |
||
21 | |||
22 | /** |
||
23 | * CollectionIterator constructor. |
||
24 | * |
||
25 | * @param Collection $collection |
||
26 | */ |
||
27 | 2 | public function __construct(Collection $collection) |
|
31 | |||
32 | /** |
||
33 | * Return the current element |
||
34 | * |
||
35 | * @link http://php.net/manual/en/iterator.current.php |
||
36 | * @return Model |
||
37 | */ |
||
38 | 2 | public function current() |
|
42 | |||
43 | /** |
||
44 | * Move forward to next element |
||
45 | * |
||
46 | * @link http://php.net/manual/en/iterator.next.php |
||
47 | * @return Model |
||
48 | */ |
||
49 | 2 | public function next() |
|
53 | |||
54 | /** |
||
55 | * Checks if current position is valid |
||
56 | * |
||
57 | * @link http://php.net/manual/en/iterator.valid.php |
||
58 | * @return boolean |
||
59 | */ |
||
60 | 2 | public function valid() |
|
66 | |||
67 | /** |
||
68 | * Return the key of the current element |
||
69 | * |
||
70 | * @link http://php.net/manual/en/iterator.key.php |
||
71 | * @return integer |
||
72 | */ |
||
73 | 2 | public function key() |
|
77 | |||
78 | /** |
||
79 | * Rewind the Iterator to the first element |
||
80 | * |
||
81 | * @link http://php.net/manual/en/iterator.rewind.php |
||
82 | * @return void |
||
83 | */ |
||
84 | 2 | public function rewind() |
|
90 | } |