1 | <?php |
||
29 | class ResponseIterator implements Iterator, ArrayAccess, Countable, Serializable |
||
30 | { |
||
31 | /** |
||
32 | * List of parser results from array |
||
33 | * |
||
34 | * @var array |
||
35 | */ |
||
36 | private $parsed = []; |
||
37 | |||
38 | /** |
||
39 | * List of RAW results from RouterOS |
||
40 | * |
||
41 | * @var array |
||
42 | */ |
||
43 | private $raw; |
||
44 | |||
45 | /** |
||
46 | * Initial value of array position |
||
47 | * |
||
48 | * @var int |
||
49 | */ |
||
50 | private $current = 0; |
||
51 | |||
52 | /** |
||
53 | * Object of main client |
||
54 | * |
||
55 | * @var \RouterOS\Client |
||
56 | */ |
||
57 | private $client; |
||
58 | |||
59 | /** |
||
60 | * ResponseIterator constructor. |
||
61 | * |
||
62 | * @param Client $client |
||
63 | */ |
||
64 | public function __construct(Client $client) |
||
99 | |||
100 | /** |
||
101 | * Move forward to next element |
||
102 | */ |
||
103 | public function next(): void |
||
107 | |||
108 | /** |
||
109 | * Previous value |
||
110 | */ |
||
111 | public function prev(): void |
||
115 | |||
116 | /** |
||
117 | * Return the current element |
||
118 | * |
||
119 | * @return mixed |
||
120 | */ |
||
121 | public function current() |
||
139 | |||
140 | /** |
||
141 | * Return the key of the current element |
||
142 | * |
||
143 | * @return mixed |
||
144 | */ |
||
145 | public function key() |
||
149 | |||
150 | /** |
||
151 | * Checks if current position is valid |
||
152 | * |
||
153 | * @return bool |
||
154 | */ |
||
155 | public function valid(): bool |
||
159 | |||
160 | /** |
||
161 | * Count elements of an object |
||
162 | * |
||
163 | * @return int |
||
164 | */ |
||
165 | public function count(): int |
||
169 | |||
170 | /** |
||
171 | * Rewind the Iterator to the first element |
||
172 | */ |
||
173 | public function rewind(): void |
||
177 | |||
178 | /** |
||
179 | * Offset to set |
||
180 | * |
||
181 | * @param mixed $offset |
||
182 | * @param mixed $value |
||
183 | */ |
||
184 | public function offsetSet($offset, $value): void |
||
192 | |||
193 | /** |
||
194 | * Whether a offset exists |
||
195 | * |
||
196 | * @param mixed $offset |
||
197 | * |
||
198 | * @return bool |
||
199 | */ |
||
200 | public function offsetExists($offset): bool |
||
204 | |||
205 | /** |
||
206 | * Offset to unset |
||
207 | * |
||
208 | * @param mixed $offset |
||
209 | */ |
||
210 | public function offsetUnset($offset): void |
||
214 | |||
215 | /** |
||
216 | * Offset to retrieve |
||
217 | * |
||
218 | * @param mixed $offset |
||
219 | * |
||
220 | * @return bool|mixed |
||
221 | */ |
||
222 | public function offsetGet($offset) |
||
237 | |||
238 | /** |
||
239 | * String representation of object |
||
240 | * |
||
241 | * @return string |
||
242 | */ |
||
243 | public function serialize(): string |
||
247 | |||
248 | /** |
||
249 | * Constructs the object |
||
250 | * |
||
251 | * @param string $serialized |
||
252 | */ |
||
253 | public function unserialize($serialized): void |
||
257 | } |
||
258 |