| 1 | <?php |
||
| 14 | final class PathUtil |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * Extracts the file basename from a file path |
||
| 18 | * |
||
| 19 | * @param string $path File path |
||
| 20 | * @return string The file basename or the input value if it has no path component. |
||
| 21 | */ |
||
| 22 | 24 | public static function basename($path) |
|
| 26 | |||
| 27 | /** |
||
| 28 | * Sanitizes an extension. |
||
| 29 | * |
||
| 30 | * Strips dot from the beginning, converts to lowercase and remove trailing |
||
| 31 | * whitespaces |
||
| 32 | * |
||
| 33 | * @param string $extension |
||
| 34 | * @return string The sanitized extension |
||
| 35 | */ |
||
| 36 | 28 | public static function sanitizeExtension($extension) |
|
| 40 | |||
| 41 | /** |
||
| 42 | * Returns the extension of a file |
||
| 43 | * |
||
| 44 | * @param string $path |
||
| 45 | * @return string |
||
| 46 | */ |
||
| 47 | 28 | public static function extractExtension($path) |
|
| 51 | } |
||
| 52 |