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 \RouterOS\Client $client |
||
63 | * @param array $options Additional options |
||
64 | */ |
||
65 | 3 | public function __construct(Client $client, array $options = []) |
|
100 | |||
101 | /** |
||
102 | * Move forward to next element |
||
103 | */ |
||
104 | 1 | public function next(): void |
|
108 | |||
109 | /** |
||
110 | * Previous value |
||
111 | */ |
||
112 | 1 | public function prev(): void |
|
116 | |||
117 | /** |
||
118 | * Return the current element |
||
119 | * |
||
120 | * @return mixed |
||
121 | */ |
||
122 | 1 | public function current() |
|
140 | |||
141 | /** |
||
142 | * Return the key of the current element |
||
143 | * |
||
144 | * @return mixed |
||
145 | */ |
||
146 | 1 | public function key() |
|
150 | |||
151 | /** |
||
152 | * Checks if current position is valid |
||
153 | * |
||
154 | * @return bool |
||
155 | */ |
||
156 | 1 | public function valid(): bool |
|
160 | |||
161 | /** |
||
162 | * Count elements of an object |
||
163 | * |
||
164 | * @return int |
||
165 | */ |
||
166 | 1 | public function count(): int |
|
170 | |||
171 | /** |
||
172 | * Rewind the Iterator to the first element |
||
173 | */ |
||
174 | 3 | public function rewind(): void |
|
178 | |||
179 | /** |
||
180 | * Offset to set |
||
181 | * |
||
182 | * @param mixed $offset |
||
183 | * @param mixed $value |
||
184 | */ |
||
185 | 1 | public function offsetSet($offset, $value): void |
|
193 | |||
194 | /** |
||
195 | * Whether a offset exists |
||
196 | * |
||
197 | * @param mixed $offset |
||
198 | * |
||
199 | * @return bool |
||
200 | */ |
||
201 | public function offsetExists($offset): bool |
||
205 | |||
206 | /** |
||
207 | * Offset to unset |
||
208 | * |
||
209 | * @param mixed $offset |
||
210 | */ |
||
211 | public function offsetUnset($offset): void |
||
215 | |||
216 | /** |
||
217 | * Offset to retrieve |
||
218 | * |
||
219 | * @param mixed $offset |
||
220 | * |
||
221 | * @return bool|mixed |
||
222 | */ |
||
223 | 1 | public function offsetGet($offset) |
|
238 | |||
239 | /** |
||
240 | * String representation of object |
||
241 | * |
||
242 | * @return string |
||
243 | */ |
||
244 | 1 | public function serialize(): string |
|
248 | |||
249 | /** |
||
250 | * Constructs the object |
||
251 | * |
||
252 | * @param string $serialized |
||
253 | */ |
||
254 | public function unserialize($serialized): void |
||
258 | } |
||
259 |