| Conditions | 5 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 29 | public function parse(string $input): Result |
||
| 30 | { |
||
| 31 | $error = null; |
||
| 32 | $errorPosition = INF; |
||
| 33 | foreach ($this->options as $parser) { |
||
| 34 | $result = $parser->parse($input); |
||
| 35 | if ($result->ok()) { |
||
| 36 | return $result; |
||
| 37 | } |
||
| 38 | $pos = strlen($result->unparsed()); |
||
| 39 | if ($pos < $errorPosition) { |
||
| 40 | $errorPosition = $pos; |
||
| 41 | $error = $result; |
||
| 42 | } |
||
| 43 | } |
||
| 44 | return $error ?: Error::in($input); |
||
| 45 | } |
||
| 52 |