| Total Complexity | 6 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class Type |
||
| 10 | { |
||
| 11 | public const FILE = 1; |
||
| 12 | public const IMAGE = 2; |
||
| 13 | public const DOC = 3; |
||
| 14 | public const VIDEO = 4; |
||
| 15 | public const AUDIO = 5; |
||
| 16 | public const ARCHIVE = 5; |
||
| 17 | |||
| 18 | public static $folderPrefix = [ |
||
| 19 | self::FILE => 'file', |
||
| 20 | self::IMAGE => 'image', |
||
| 21 | self::DOC => 'doc', |
||
| 22 | self::VIDEO => 'video', |
||
| 23 | self::AUDIO => 'audio', |
||
| 24 | self::ARCHIVE => 'archive', |
||
| 25 | ]; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @return array |
||
| 29 | */ |
||
| 30 | public static function all(): array |
||
| 31 | { |
||
| 32 | return [ |
||
| 33 | self::FILE => 'File', |
||
| 34 | self::IMAGE => 'Image', |
||
| 35 | self::DOC => 'Document', |
||
| 36 | self::VIDEO => 'Video', |
||
| 37 | self::AUDIO => 'Audio', |
||
| 38 | self::ARCHIVE => 'Archive', |
||
| 39 | ]; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @param int $id |
||
| 44 | * @return string |
||
| 45 | */ |
||
| 46 | public static function get(int $id): ?string |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Returns file type by its mime type. |
||
| 53 | * @param string|null $mimeType |
||
| 54 | * @return int |
||
| 55 | */ |
||
| 56 | public static function getByMimeType(?string $mimeType): int |
||
| 69 | } |