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