Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2.004 |
1 | <?php |
||
27 | 4 | public function load($path) |
|
28 | { |
||
29 | 4 | $uri = $this->prefix . $path; |
|
30 | 4 | set_error_handler(function () use ($uri) { |
|
31 | 2 | throw new SchemaLoadingException($uri); |
|
32 | 4 | }); |
|
33 | 4 | $response = file_get_contents($uri); |
|
34 | 2 | restore_error_handler(); |
|
35 | |||
36 | 2 | if (!$response) { |
|
37 | throw SchemaLoadingException::create($uri); |
||
38 | } |
||
39 | |||
40 | 2 | return JsonGuard\json_decode($response); |
|
41 | } |
||
42 | } |
||
43 |