1 | <?php |
||
9 | class FileHelper |
||
10 | { |
||
11 | /** |
||
12 | * Check if passed path exists or try to create it. |
||
13 | * Return false if it fails to create it. |
||
14 | * @param string $filedPath |
||
15 | * @param string $modeMask Ex.: '0755' |
||
16 | * @return bool |
||
17 | */ |
||
18 | public static function checkDirExistOrCreate(string $filedPath, string $modeMask) : bool |
||
27 | |||
28 | /** |
||
29 | * Return the file name of file (without path and witout extension). |
||
30 | * Ex.: \public\upload\pippo.txt return 'pippo' |
||
31 | * @param string $filePath |
||
32 | * @return string |
||
33 | */ |
||
34 | public function getFilenameWithoutExtension(string $filePath) : string |
||
44 | |||
45 | /** |
||
46 | * unlink file if exists. |
||
47 | * Return false if exists and unlink fails. |
||
48 | * @param string $filePath |
||
49 | * @return bool |
||
50 | */ |
||
51 | public function unlinkSafe(string $filePath) : bool |
||
59 | } |
||
60 |