Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | public static function getMimeType($filePath) |
||
15 | { |
||
16 | if (!file_exists($filePath)) { |
||
17 | throw new InvalidRequest("$filePath: failed to open file."); |
||
18 | } |
||
19 | |||
20 | $fileInfo = finfo_open(FILEINFO_MIME_TYPE); |
||
21 | $type = finfo_file($fileInfo, $filePath); |
||
22 | finfo_close($fileInfo); |
||
23 | |||
24 | return $type; |
||
25 | } |
||
36 |