Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
42 | public function load(string $file): stdClass |
||
43 | { |
||
44 | if (file_exists($file) === false) { |
||
45 | throw new LoaderLoadException(sprintf('The JSON schema "%s" could not be found.', $file)); |
||
46 | } |
||
47 | |||
48 | $json = json_decode(file_get_contents($file), false, 512, self::DECODE_OPTIONS); |
||
49 | if (json_last_error() !== JSON_ERROR_NONE) { |
||
50 | throw new LoaderLoadException(sprintf('The JSON schema "%s" contains invalid JSON: %s', $file, json_last_error_msg())); |
||
51 | } |
||
52 | |||
53 | return $json; |
||
54 | } |
||
56 |