1 | <?php |
||
24 | class ResponseIterator implements Iterator, ArrayAccess, Countable, Serializable |
||
25 | { |
||
26 | /** |
||
27 | * List of parser results from array |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | private $parsed = []; |
||
32 | |||
33 | /** |
||
34 | * List of RAW results from RouterOS |
||
35 | * |
||
36 | * @var array |
||
37 | */ |
||
38 | private $raw = []; |
||
39 | |||
40 | /** |
||
41 | * Initial value of array position |
||
42 | * |
||
43 | * @var int |
||
44 | */ |
||
45 | private $current = 0; |
||
46 | |||
47 | /** |
||
48 | * Object of main client |
||
49 | * |
||
50 | * @var \RouterOS\Client |
||
51 | */ |
||
52 | private $client; |
||
53 | |||
54 | /** |
||
55 | * ResponseIterator constructor. |
||
56 | * |
||
57 | * @param Client $client |
||
58 | */ |
||
59 | 4 | public function __construct(Client $client) |
|
94 | |||
95 | /** |
||
96 | * Move forward to next element |
||
97 | */ |
||
98 | 1 | public function next() |
|
102 | |||
103 | /** |
||
104 | * Previous value |
||
105 | */ |
||
106 | 1 | public function prev() |
|
110 | |||
111 | /** |
||
112 | * Return the current element |
||
113 | * |
||
114 | * @return mixed |
||
115 | */ |
||
116 | 1 | public function current() |
|
134 | |||
135 | /** |
||
136 | * Return the key of the current element |
||
137 | * |
||
138 | * @return mixed |
||
139 | */ |
||
140 | 1 | public function key() |
|
144 | |||
145 | /** |
||
146 | * Checks if current position is valid |
||
147 | * |
||
148 | * @return bool |
||
149 | */ |
||
150 | 1 | public function valid(): bool |
|
154 | |||
155 | /** |
||
156 | * Count elements of an object |
||
157 | * |
||
158 | * @return int |
||
159 | */ |
||
160 | 1 | public function count(): int |
|
164 | |||
165 | /** |
||
166 | * Rewind the Iterator to the first element |
||
167 | */ |
||
168 | 4 | public function rewind() |
|
172 | |||
173 | /** |
||
174 | * Offset to set |
||
175 | * |
||
176 | * @param mixed $offset |
||
177 | * @param mixed $value |
||
178 | */ |
||
179 | 1 | public function offsetSet($offset, $value) |
|
187 | |||
188 | /** |
||
189 | * Whether a offset exists |
||
190 | * |
||
191 | * @param mixed $offset |
||
192 | * |
||
193 | * @return bool |
||
194 | */ |
||
195 | public function offsetExists($offset): bool |
||
199 | |||
200 | /** |
||
201 | * Offset to unset |
||
202 | * |
||
203 | * @param mixed $offset |
||
204 | */ |
||
205 | public function offsetUnset($offset) |
||
209 | |||
210 | /** |
||
211 | * Offset to retrieve |
||
212 | * |
||
213 | * @param mixed $offset |
||
214 | * |
||
215 | * @return bool|mixed |
||
216 | */ |
||
217 | 1 | public function offsetGet($offset) |
|
232 | |||
233 | /** |
||
234 | * String representation of object |
||
235 | * |
||
236 | * @return string |
||
237 | */ |
||
238 | 1 | public function serialize(): string |
|
242 | |||
243 | /** |
||
244 | * Constructs the object |
||
245 | * |
||
246 | * @param string $serialized |
||
247 | */ |
||
248 | public function unserialize($serialized) |
||
252 | } |
||
253 |