| Conditions | 5 |
| Paths | 3 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | 3 | public function __construct($path) |
|
| 22 | { |
||
| 23 | 3 | if (!is_readable($path) || ($content = file_get_contents($path)) === false) { |
|
| 24 | 1 | throw new NotReadableException('unable to read ' . $path); |
|
| 25 | } |
||
| 26 | 2 | $this->data = json_decode($content, true); |
|
| 27 | 2 | if ($this->data === null && JSON_ERROR_NONE !== json_last_error()) { |
|
| 28 | 1 | throw new InvalidJsonException('error parsing ' . $path . ': ' . json_last_error_msg()); |
|
| 29 | } |
||
| 30 | 1 | } |
|
| 31 | |||
| 42 |