1 | <?php |
||
10 | class Directory |
||
11 | { |
||
12 | /** |
||
13 | * Check if directory is exist and readable. Alias for File::exist() |
||
14 | * @param string $path |
||
15 | * @return bool |
||
16 | */ |
||
17 | public static function exist($path) |
||
23 | |||
24 | /** |
||
25 | * Check if directory is writable |
||
26 | * @param string $path |
||
27 | * @return bool |
||
28 | */ |
||
29 | public static function writable($path) |
||
39 | |||
40 | /** |
||
41 | * Create directory with recursive support. |
||
42 | * @param string $path |
||
43 | * @param int $chmod |
||
44 | * @return bool |
||
45 | */ |
||
46 | public static function create($path, $chmod = 0755) |
||
56 | |||
57 | /** |
||
58 | * Remove directory recursive. |
||
59 | * @param string $path |
||
60 | * @return bool |
||
61 | */ |
||
62 | public static function remove($path) |
||
75 | |||
76 | /** |
||
77 | * Scan files in directory and return full or relative path |
||
78 | * @param string $path |
||
79 | * @param int $mod |
||
80 | * @param bool|false $returnRelative |
||
81 | * @return array|bool |
||
82 | */ |
||
83 | public static function scan($path, $mod = GLOB_ONLYDIR, $returnRelative = false) |
||
102 | |||
103 | /** |
||
104 | * Rename directory based only on new name for last element. Example: rename('/var/www/html', 'php') => /var/www/php |
||
105 | * @param string $path |
||
106 | * @param string $newDirName |
||
107 | * @return bool |
||
108 | */ |
||
109 | public static function rename($path, $newDirName) |
||
126 | |||
127 | /** |
||
128 | * Change chmod recursive inside defined folder |
||
129 | * @param string $path |
||
130 | * @param int $mod |
||
131 | */ |
||
132 | public static function recursiveChmod($path, $mod = 0777) { |
||
147 | } |
If you suppress an error, we recommend checking for the error condition explicitly: