| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public static function createParser(string $parserType) |
||
| 20 | { |
||
| 21 | if (!in_array($parserType, self::$validParsers, true)) { |
||
| 22 | $message = sprintf( |
||
| 23 | 'Invalid parser type: %s. Valid types are case sensitive and possible values are: %s', |
||
| 24 | $parserType, |
||
| 25 | implode(', ', array_keys(self::$validParsers)) |
||
| 26 | ); |
||
| 27 | throw new UnexpectedValueException($message); |
||
| 28 | } |
||
| 29 | return new self::$validParsers[$parserType](); |
||
| 30 | } |
||
| 31 | } |
||
| 32 |