| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php namespace HSkrasek\OpenAPI\Loaders; |
||
| 31 | public function load($path) |
||
| 32 | { |
||
| 33 | $uri = 'file://' . $path; |
||
| 34 | |||
| 35 | if (!file_exists($uri)) { |
||
| 36 | throw SchemaLoadingException::notFound($uri); |
||
| 37 | } |
||
| 38 | |||
| 39 | $schema = file_get_contents($uri); |
||
| 40 | |||
| 41 | try { |
||
| 42 | return $this->jsonDecoder->decode($schema); |
||
| 43 | } catch (DecodingException $e) { |
||
| 44 | return $this->yamlDecoder->decode($schema); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | } |
||
| 48 |