Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 2 |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
24 | 6 | public function parse($path) |
|
25 | { |
||
26 | 6 | $data = json_decode(file_get_contents($path), true); |
|
27 | |||
28 | 6 | if (json_last_error() !== JSON_ERROR_NONE) { |
|
29 | 3 | $error = array( |
|
30 | 3 | 'message' => 'Syntax error', |
|
31 | 1 | 'type' => json_last_error(), |
|
32 | 1 | 'file' => $path, |
|
33 | ); |
||
34 | throw new ParseException($error); |
||
35 | 3 | } |
|
36 | 3 | ||
37 | 3 | return $data; |
|
38 | 3 | } |
|
39 | 3 | ||
48 |