| Conditions | 3 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types = 1); |
||
| 23 | public function read(string $uri): Response |
||
| 24 | { |
||
| 25 | $contents = @file_get_contents($uri); |
||
| 26 | |||
| 27 | if (false === $contents) { |
||
| 28 | throw new ResourceNotReadableException("Failed reading '$uri'"); |
||
| 29 | } |
||
| 30 | |||
| 31 | return new Response( |
||
| 32 | preg_match('/\b(yml|yaml|raml)\b/', $uri) ? self::CONTENT_TYPE_YAML : self::CONTENT_TYPE_JSON, |
||
| 33 | $contents |
||
| 34 | ); |
||
| 35 | } |
||
| 36 | } |
||
| 37 |