| Total Complexity | 6 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | class All extends Parser |
||
| 17 | { |
||
| 18 | use ArgumentsTrait; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var Parser[] |
||
| 22 | */ |
||
| 23 | private $parsers = []; |
||
| 24 | |||
| 25 | 2 | public function __construct(...$arguments) |
|
| 31 | 1 | } |
|
| 32 | |||
| 33 | 14 | protected function parse(&$input, $offset, Context $context) |
|
| 34 | { |
||
| 35 | 14 | $length = PHP_INT_MAX; |
|
| 36 | 14 | foreach ($this->parsers as $parser) { |
|
| 37 | 14 | $match = $parser->parse($input, $offset, $context); |
|
| 38 | 14 | $length = min($length, $match->length); |
|
| 39 | 14 | if (!($match instanceof Success)) { |
|
| 40 | 14 | return $this->failure($input, $offset, $length); |
|
| 41 | } |
||
| 42 | } |
||
| 43 | |||
| 44 | 11 | return $this->success($input, $offset, $length); |
|
| 45 | } |
||
| 46 | |||
| 47 | 14 | public function __toString() |
|
| 50 | } |
||
| 51 | } |
||
| 52 |