1 | <?php |
||
38 | class Filesystem |
||
39 | { |
||
40 | /** |
||
41 | * Checks if a file is writeable. |
||
42 | * In cases where the file cannot be written to an exception is thrown. |
||
43 | * |
||
44 | * @param string $path The path to the file to be checked. |
||
45 | * @throws exceptions\FileNotWriteableException |
||
46 | */ |
||
47 | 11 | public static function checkWritable(string $path): void |
|
53 | |||
54 | /** |
||
55 | * Check if a file is readable. |
||
56 | * In cases where the file cannot be read, an exception is thrown. |
||
57 | * |
||
58 | * @param string $path The path to the file to be checked. |
||
59 | * @throws exceptions\FileNotReadableException |
||
60 | */ |
||
61 | 11 | public static function checkReadable(string $path): void |
|
67 | |||
68 | /** |
||
69 | * Checks if a file exists and throws an exception if not. |
||
70 | * |
||
71 | * @param string $path |
||
72 | * @throws exceptions\FileNotFoundException |
||
73 | */ |
||
74 | 14 | public static function checkExists(string $path): void |
|
80 | |||
81 | /** |
||
82 | * Checks if a file exists and throws an exception if it does. |
||
83 | * |
||
84 | * @param string $path |
||
85 | * @throws exceptions\FileAlreadyExistsException |
||
86 | */ |
||
87 | 3 | public static function checkNotExists(string $path): void |
|
93 | |||
94 | /** |
||
95 | * Checks if a file exists and is writeable and throws a relevant exception if either condition is not met. |
||
96 | * |
||
97 | * @param $path |
||
98 | * @throws exceptions\FileNotFoundException |
||
99 | * @throws exceptions\FileNotWriteableException |
||
100 | */ |
||
101 | 7 | public static function checkWriteSafety($path) |
|
106 | |||
107 | /** |
||
108 | * Checks if a file exists and is readable and throws a relevant excetion if either condition is not met. |
||
109 | * |
||
110 | * @param $path |
||
111 | * @throws exceptions\FileNotFoundException |
||
112 | * @throws exceptions\FileNotReadableException |
||
113 | */ |
||
114 | 3 | public static function checkReadSafety($path) |
|
119 | |||
120 | /** |
||
121 | * Return an instance of the relevant FileInterface (File or Directory) for a file in a given path. |
||
122 | * |
||
123 | * @param string $path |
||
124 | * @return FileInterface |
||
125 | * @throws FileNotFoundException |
||
126 | */ |
||
127 | 1 | public static function get($path) |
|
136 | |||
137 | 5 | public static function file($path) |
|
141 | |||
142 | 5 | public static function directory($path) |
|
146 | |||
147 | public static function glob($glob) |
||
151 | |||
152 | public static function getAbsolutePath($path, $relativeTo = null) |
||
162 | } |
||
163 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.