1 | <?php |
||
24 | class FilesystemHelper { |
||
25 | |||
26 | /** |
||
27 | * Wrapper for scandir function |
||
28 | * @param string $path |
||
29 | * @return array |
||
30 | */ |
||
31 | public function scandir($path){ |
||
34 | |||
35 | /** |
||
36 | * Wrapper for file_exists function |
||
37 | * @param string $path |
||
38 | * @return bool |
||
39 | */ |
||
40 | public function fileExists($path){ |
||
43 | |||
44 | /** |
||
45 | * Wrapper for is_writable function |
||
46 | * @param string $path |
||
47 | * @return bool |
||
48 | */ |
||
49 | public function isWritable($path){ |
||
52 | |||
53 | /** |
||
54 | * Wrapper for mkdir |
||
55 | * @param string $path |
||
56 | * @param bool $isRecursive |
||
57 | * @throws \Exception on error |
||
58 | */ |
||
59 | public function mkdir($path, $isRecursive = false){ |
||
64 | |||
65 | /** |
||
66 | * Copy recursive |
||
67 | * @param string $src - source path |
||
68 | * @param string $dest - destination path |
||
69 | * @throws \Exception on error |
||
70 | */ |
||
71 | public function copyr($src, $dest, $stopOnError = true){ |
||
94 | |||
95 | /** |
||
96 | * Moves file/directory |
||
97 | * @param string $src - source path |
||
98 | * @param string $dest - destination path |
||
99 | * @throws \Exception on error |
||
100 | */ |
||
101 | public function move($src, $dest){ |
||
106 | |||
107 | /** |
||
108 | * Check permissions recursive |
||
109 | * @param string $src - path to check |
||
110 | * @param Collection $collection - object to store incorrect permissions |
||
111 | */ |
||
112 | public function checkr($src, $collection){ |
||
131 | |||
132 | public function removeIfExists($path) { |
||
143 | |||
144 | protected function rmdirr($dir) { |
||
162 | |||
163 | } |
||
164 |
If you suppress an error, we recommend checking for the error condition explicitly: