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