| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 2 |
| CRAP Score | 6.28 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | 14 | public function __construct(array $data) |
|
| 17 | { |
||
| 18 | try { |
||
| 19 | 14 | $this->parse($data); |
|
| 20 | } catch (\Throwable $e) { |
||
| 21 | $message = sprintf('Failed to parse %s: %s', get_called_class(), $e->getMessage()); |
||
| 22 | |||
| 23 | if(!empty($data['id'])) { |
||
| 24 | $message .= ' ID: ' . $data['id']; |
||
| 25 | } |
||
| 26 | |||
| 27 | throw new FailedToParseException($message); |
||
| 28 | } |
||
| 34 | } |