| Total Complexity | 7 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | abstract class IterableParser extends Parser implements \IteratorAggregate, \ArrayAccess |
||
| 14 | { |
||
| 15 | use ArgumentsTrait; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var Parser[] $parsers |
||
| 19 | */ |
||
| 20 | protected $parsers = []; |
||
| 21 | |||
| 22 | // implements IteratorAggregate |
||
| 23 | |||
| 24 | public function getIterator() |
||
| 25 | { |
||
| 26 | return new \ArrayIterator($this->parsers); |
||
| 27 | } |
||
| 28 | |||
| 29 | // implements ArrayAccess |
||
| 30 | |||
| 31 | public function offsetSet($offset, $value) |
||
| 32 | { |
||
| 33 | $value = self::getArgument($value); |
||
| 34 | |||
| 35 | if (is_null($offset)) { |
||
| 36 | $this->parsers[] = $value; |
||
| 37 | } else { |
||
| 38 | $this->parsers[$offset] = $value; |
||
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | public function offsetExists($offset) |
||
| 43 | { |
||
| 44 | return isset($this->parsers[$offset]); |
||
| 45 | } |
||
| 46 | |||
| 47 | public function offsetUnset($offset) |
||
| 50 | } |
||
| 51 | |||
| 52 | public function offsetGet($offset) |
||
| 55 | } |
||
| 56 | } |
||
| 57 |