Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
28 | 16 | public function load($path) |
|
29 | { |
||
30 | 16 | if (!array_key_exists($path, $this->schemas)) { |
|
31 | 6 | throw SchemaLoadingException::notFound($path); |
|
32 | } |
||
33 | |||
34 | 12 | $schema = $this->schemas[$path]; |
|
35 | |||
36 | 12 | if (is_string($schema)) { |
|
37 | 8 | return JsonGuard\json_decode($schema); |
|
38 | 6 | } elseif (is_object($schema)) { |
|
39 | 4 | return $schema; |
|
40 | } else { |
||
41 | 2 | throw SchemaLoadingException::create($path); |
|
42 | } |
||
43 | } |
||
44 | } |
||
45 |