| Total Complexity | 3 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class FileHelper |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @param string $filePath |
||
| 11 | * @return mixed |
||
| 12 | * @throws InvalidRequest |
||
| 13 | */ |
||
| 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 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @param string $source |
||
| 29 | * @param string $destination |
||
| 30 | */ |
||
| 31 | public static function saveTo($source, $destination) |
||
| 34 | } |
||
| 35 | } |
||
| 36 |