1 | <?php |
||
16 | abstract class AbstractIterator implements Iterator |
||
17 | { |
||
18 | /** |
||
19 | * Queue of elements to be iterated |
||
20 | * |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $queue = []; |
||
24 | |||
25 | /** |
||
26 | * Total number of elements in queue |
||
27 | * |
||
28 | * @var int |
||
29 | */ |
||
30 | protected $total = 0; |
||
31 | |||
32 | /** |
||
33 | * Cursor position |
||
34 | * |
||
35 | * @var int |
||
36 | */ |
||
37 | protected $iterated = 0; |
||
38 | |||
39 | /** |
||
40 | * Return the current element |
||
41 | * |
||
42 | * @return mixed |
||
43 | */ |
||
44 | 3 | public function current() |
|
48 | |||
49 | /** |
||
50 | * Move forward to next element |
||
51 | * |
||
52 | * @return void |
||
53 | */ |
||
54 | 10 | public function next(): void |
|
58 | |||
59 | /** |
||
60 | * Return the key of the current element |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | 7 | public function key(): string |
|
68 | |||
69 | /** |
||
70 | * Checks if current position is valid |
||
71 | * |
||
72 | * @return bool |
||
73 | */ |
||
74 | 6 | public function valid(): bool |
|
78 | |||
79 | /** |
||
80 | * Rewind the Iterator to the first element |
||
81 | * |
||
82 | * @return void |
||
83 | */ |
||
84 | 2 | public function rewind(): void |
|
88 | } |
||
89 |