1 | <?php |
||
37 | class Filesystem |
||
38 | { |
||
39 | /** |
||
40 | * Checks if a file is writeable. |
||
41 | * In cases where the file cannot be written to an exception is thrown. |
||
42 | * |
||
43 | 11 | * @param string $path The path to the file to be checked. |
|
44 | * @throws exceptions\FileNotWriteableException |
||
45 | 11 | */ |
|
46 | 2 | public static function checkWritable(string $path) : void |
|
52 | |||
53 | /** |
||
54 | * Check if a file is readable. |
||
55 | * In cases where the file cannot be read, an exception is thrown. |
||
56 | * |
||
57 | 11 | * @param string $path The path to the file to be checked. |
|
58 | * @throws exceptions\FileNotReadableException |
||
59 | 11 | */ |
|
60 | 2 | public static function checkReadable(string $path) : void |
|
66 | |||
67 | /** |
||
68 | * Checks if a file exists and throws an exception if not. |
||
69 | * |
||
70 | 14 | * @param $path |
|
71 | * @throws exceptions\FileNotFoundException |
||
72 | 14 | */ |
|
73 | 5 | public static function checkExists(string $path) : void |
|
79 | |||
80 | /** |
||
81 | * Checks if a file exists and throws an exception if it does. |
||
82 | * |
||
83 | 3 | * @param string $path |
|
84 | * @throws exceptions\FileAlreadyExistsException |
||
85 | 3 | */ |
|
86 | 1 | public static function checkNotExists(string $path) : void |
|
92 | |||
93 | /** |
||
94 | * Checks if a file exists and is writeable and throws a relevant exception if either condition is not met. |
||
95 | * |
||
96 | * @param $path |
||
97 | 7 | * @throws exceptions\FileNotFoundException |
|
98 | * @throws exceptions\FileNotWriteableException |
||
99 | 7 | */ |
|
100 | 6 | public static function checkWriteSafety($path) |
|
105 | |||
106 | /** |
||
107 | * Checks if a file exists and is readable and throws a relevant excetion if either condition is not met. |
||
108 | * |
||
109 | * @param $path |
||
110 | 3 | * @throws exceptions\FileNotFoundException |
|
111 | * @throws exceptions\FileNotReadableException |
||
112 | 3 | */ |
|
113 | 2 | public static function checkReadSafety($path) |
|
118 | |||
119 | /** |
||
120 | * Return an instance of the relevant FileInterface (File or Directory) for a file in a given path. |
||
121 | * |
||
122 | 6 | * @param string $path |
|
123 | * @return FileInterface |
||
124 | 6 | */ |
|
125 | 6 | public static function get($path) |
|
134 | |||
135 | public static function file($path) |
||
139 | |||
140 | public static function directory($path) |
||
144 | |||
145 | public static function glob($glob) |
||
149 | } |
||
150 |