1 | <?php |
||
18 | class ResponseIterator implements \Iterator, \ArrayAccess, \Countable |
||
19 | { |
||
20 | /** |
||
21 | * List of parser results from array |
||
22 | * |
||
23 | * @var array |
||
24 | */ |
||
25 | private $parsed = []; |
||
26 | |||
27 | /** |
||
28 | * List of RAW results from RouterOS |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | private $raw = []; |
||
33 | |||
34 | /** |
||
35 | * Initial value of array position |
||
36 | * |
||
37 | * @var int |
||
38 | */ |
||
39 | private $current; |
||
40 | |||
41 | /** |
||
42 | * Object of main client |
||
43 | * |
||
44 | * @var \RouterOS\Client |
||
45 | */ |
||
46 | private $client; |
||
47 | |||
48 | /** |
||
49 | * ResponseIterator constructor. |
||
50 | * |
||
51 | * @param Client $client |
||
52 | */ |
||
53 | public function __construct(Client $client) |
||
88 | |||
89 | /** |
||
90 | * Move forward to next element |
||
91 | */ |
||
92 | public function next() |
||
96 | |||
97 | /** |
||
98 | * Return the current element |
||
99 | * |
||
100 | * @return mixed |
||
101 | */ |
||
102 | public function current() |
||
114 | |||
115 | /** |
||
116 | * Return the key of the current element |
||
117 | * |
||
118 | * @return mixed |
||
119 | */ |
||
120 | public function key() |
||
124 | |||
125 | /** |
||
126 | * Checks if current position is valid |
||
127 | * |
||
128 | * @return bool |
||
129 | */ |
||
130 | public function valid(): bool |
||
134 | |||
135 | /** |
||
136 | * Count elements of an object |
||
137 | * |
||
138 | * @return int |
||
139 | */ |
||
140 | public function count(): int |
||
144 | |||
145 | /** |
||
146 | * Rewind the Iterator to the first element |
||
147 | */ |
||
148 | public function rewind() |
||
152 | |||
153 | /** |
||
154 | * Offset to set |
||
155 | * |
||
156 | * @param mixed $offset |
||
157 | * @param mixed $value |
||
158 | */ |
||
159 | public function offsetSet($offset, $value) |
||
167 | |||
168 | /** |
||
169 | * Whether a offset exists |
||
170 | * |
||
171 | * @param mixed $offset |
||
172 | * @return bool |
||
173 | */ |
||
174 | public function offsetExists($offset): bool |
||
178 | |||
179 | /** |
||
180 | * Offset to unset |
||
181 | * |
||
182 | * @param mixed $offset |
||
183 | */ |
||
184 | public function offsetUnset($offset) |
||
188 | |||
189 | /** |
||
190 | * Offset to retrieve |
||
191 | * |
||
192 | * @param mixed $offset |
||
193 | * @return bool|mixed |
||
194 | */ |
||
195 | public function offsetGet($offset) |
||
210 | } |
||
211 |