| Conditions | 5 |
| Paths | 5 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | public function guess($path) |
||
| 33 | { |
||
| 34 | if (!is_file($path)) { |
||
| 35 | throw new FileNotFoundException($path); |
||
| 36 | } |
||
| 37 | |||
| 38 | if (!is_readable($path)) { |
||
| 39 | throw new AccessDeniedException($path); |
||
| 40 | } |
||
| 41 | |||
| 42 | if (!self::isSupported()) { |
||
| 43 | return null; |
||
| 44 | } |
||
| 45 | |||
| 46 | if (!$fileInfo = new \finfo(FILEINFO_MIME_TYPE)) { |
||
| 47 | return null; |
||
| 48 | } |
||
| 49 | |||
| 50 | return $fileInfo->file($path); |
||
| 51 | } |
||
| 52 | } |