Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
40 | public function getJsonFromFile($fileName) |
||
41 | { |
||
42 | $string = file_get_contents($this->dirService . DIRECTORY_SEPARATOR . $fileName); |
||
43 | if (!$string) { |
||
44 | throw new ServiceNotFoundException('Service not found'); |
||
45 | } |
||
46 | $json = json_decode($string); |
||
47 | if (json_last_error()) { |
||
48 | throw new InvalidJsonException('Service error, '.json_last_error_msg()); |
||
49 | } |
||
50 | return $json; |
||
51 | } |
||
52 | |||
53 | } |