@@ 257-273 (lines=17) @@ | ||
254 | * The return value varied by the behaviour of the current flag |
|
255 | * @return mixed |
|
256 | */ |
|
257 | public function current() |
|
258 | { |
|
259 | switch ($this->flags & 120) { |
|
260 | case self::CURRENT_AS_ENUM: |
|
261 | return parent::current(); |
|
262 | case self::CURRENT_AS_DATA: |
|
263 | return parent::getInfo(); |
|
264 | case self::CURRENT_AS_VALUE: |
|
265 | return parent::current()->getValue(); |
|
266 | case self::CURRENT_AS_NAME: |
|
267 | return parent::current()->getName(); |
|
268 | case self::CURRENT_AS_ORDINAL: |
|
269 | return parent::current()->getOrdinal(); |
|
270 | default: |
|
271 | throw new RuntimeException('Invalid current flag'); |
|
272 | } |
|
273 | } |
|
274 | ||
275 | /** |
|
276 | * Get the current item-key |
|
@@ 280-294 (lines=15) @@ | ||
277 | * The return value varied by the behaviour of the key flag |
|
278 | * @return null|boolean|int|float|string |
|
279 | */ |
|
280 | public function key() |
|
281 | { |
|
282 | switch ($this->flags & 7) { |
|
283 | case self::KEY_AS_INDEX: |
|
284 | return parent::key(); |
|
285 | case self::KEY_AS_NAME: |
|
286 | return parent::current()->getName(); |
|
287 | case self::KEY_AS_ORDINAL: |
|
288 | return parent::current()->getOrdinal(); |
|
289 | case self::KEY_AS_VALUE: |
|
290 | return parent::current()->getValue(); |
|
291 | default: |
|
292 | throw new RuntimeException('Invalid key flag'); |
|
293 | } |
|
294 | } |
|
295 | } |
|
296 |