| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | 12 | public function load($path) |
|
| 37 | { |
||
| 38 | 12 | if (!array_key_exists($path, $this->schemas)) { |
|
| 39 | 4 | throw SchemaLoadingException::notFound($path); |
|
| 40 | } |
||
| 41 | |||
| 42 | 10 | $schema = $this->schemas[$path]; |
|
| 43 | |||
| 44 | 10 | if (is_string($schema)) { |
|
| 45 | 4 | return $this->jsonDecoder->decode($schema); |
|
| 46 | 8 | } elseif (is_object($schema)) { |
|
| 47 | 6 | return $schema; |
|
| 48 | } else { |
||
| 49 | 2 | throw SchemaLoadingException::create($path); |
|
| 50 | } |
||
| 51 | } |
||
| 52 | } |
||
| 53 |