| Total Complexity | 4 |
| Total Lines | 24 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class AssetHelper |
||
| 8 | { |
||
| 9 | public static function isImage(string $mimeType): bool |
||
| 10 | { |
||
| 11 | return Str::endsWith($mimeType, [ |
||
| 12 | 'png', 'jpg', 'jpeg', 'gif', 'svg', 'webp' |
||
| 13 | ]); |
||
| 14 | } |
||
| 15 | |||
| 16 | public static function getExtension(string $path): string |
||
| 17 | { |
||
| 18 | return pathinfo($path, PATHINFO_EXTENSION); |
||
|
|
|||
| 19 | } |
||
| 20 | |||
| 21 | public static function getHumanReadableSize(int $sizeInBytes): string |
||
| 22 | { |
||
| 23 | [$size, $unit] = explode(' ', \Spatie\MediaLibrary\Support\File::getHumanReadableSize($sizeInBytes)); |
||
| 24 | |||
| 25 | return round($size) . ' ' . $unit; |
||
| 26 | } |
||
| 27 | |||
| 28 | public static function getBaseName(string $path): string |
||
| 31 | } |
||
| 32 | } |
||
| 33 |