| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | 6 | public function parseLine($line) |
|
| 24 | { |
||
| 25 | 6 | if (!is_string($line)) { |
|
| 26 | 1 | throw new ParserException('Parser argument must be a string.'); |
|
| 27 | } |
||
| 28 | |||
| 29 | 5 | $match = @preg_match($this->getPattern(), $line, $matches); |
|
| 30 | |||
| 31 | 5 | if ($match === false) { |
|
| 32 | 1 | $error = error_get_last(); |
|
| 33 | 1 | throw new ParserException("Matcher failure. Please check if given pattern is valid. ({$error["message"]})"); |
|
| 34 | } |
||
| 35 | |||
| 36 | 4 | if (!$match) { |
|
| 37 | 1 | throw new MatchException('Given line does not match predefined pattern.'); |
|
| 38 | } |
||
| 39 | |||
| 40 | 3 | return $this->prepareParsedData($matches); |
|
| 41 | } |
||
| 42 | |||
| 67 |