| 1 | <?php |
| 2 | |
| 3 | namespace Illuminate\Contracts\Filesystem; |
| 4 | |
| 5 | interface Filesystem |
| 6 | { |
| 7 | /** |
| 8 | * The public visibility setting. |
| 9 | * |
| 10 | * @var string |
| 11 | */ |
| 12 | const VISIBILITY_PUBLIC = 'public'; |
| 13 | |
| 14 | /** |
| 15 | * The private visibility setting. |
| 16 | * |
| 17 | * @var string |
| 18 | */ |
| 19 | const VISIBILITY_PRIVATE = 'private'; |
| 20 | |
| 21 | /** |
| 22 | * Get the full path to the file that exists at the given relative path. |
| 23 | * |
| 24 | * @param string $path |
| 25 | * @return string |
| 26 | */ |
| 27 | public function path($path); |
| 28 | |
| 29 | /** |
| 30 | * Determine if a file exists. |
| 31 | * |
| 32 | * @param string $path |
| 33 | * @return bool |
| 34 | */ |
| 35 | public function exists($path); |
| 36 | |
| 37 | /** |
| 38 | * Get the contents of a file. |
| 39 | * |
| 40 | * @param string $path |
| 41 | * @return string|null |
| 42 | */ |
| 43 | public function get($path); |
| 44 | |
| 45 | /** |
| 46 | * Get a resource to read the file. |
| 47 | * |
| 48 | * @param string $path |
| 49 | * @return resource|null The path resource or null on failure. |
| 50 | */ |
| 51 | public function readStream($path); |
| 52 | |
| 53 | /** |
| 54 | * Write the contents of a file. |
| 55 | * |
| 56 | * @param string $path |
| 57 | * @param \Psr\Http\Message\StreamInterface|\Illuminate\Http\File|\Illuminate\Http\UploadedFile|string|resource $contents |
| 58 | * @param mixed $options |
| 59 | * @return bool |
| 60 | */ |
| 61 | public function put($path, $contents, $options = []); |
| 62 | |
| 63 | /** |
| 64 | * Store the uploaded file on the disk. |
| 65 | * |
| 66 | * @param \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $path |
| 67 | * @param \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string|array|null $file |
| 68 | * @param mixed $options |
| 69 | * @return string|false |
| 70 | */ |
| 71 | public function putFile($path, $file = null, $options = []); |
| 72 | |
| 73 | /** |
| 74 | * Store the uploaded file on the disk with a given name. |
| 75 | * |
| 76 | * @param \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $path |
| 77 | * @param \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string|array|null $file |
| 78 | * @param string|array|null $name |
| 79 | * @param mixed $options |
| 80 | * @return string|false |
| 81 | */ |
| 82 | public function putFileAs($path, $file, $name = null, $options = []); |
| 83 | |
| 84 | /** |
| 85 | * Write a new file using a stream. |
| 86 | * |
| 87 | * @param string $path |
| 88 | * @param resource $resource |
| 89 | * @param array $options |
| 90 | * @return bool |
| 91 | */ |
| 92 | public function writeStream($path, $resource, array $options = []); |
| 93 | |
| 94 | /** |
| 95 | * Get the visibility for the given path. |
| 96 | * |
| 97 | * @param string $path |
| 98 | * @return string |
| 99 | */ |
| 100 | public function getVisibility($path); |
| 101 | |
| 102 | /** |
| 103 | * Set the visibility for the given path. |
| 104 | * |
| 105 | * @param string $path |
| 106 | * @param string $visibility |
| 107 | * @return bool |
| 108 | */ |
| 109 | public function setVisibility($path, $visibility); |
| 110 | |
| 111 | /** |
| 112 | * Prepend to a file. |
| 113 | * |
| 114 | * @param string $path |
| 115 | * @param string $data |
| 116 | * @return bool |
| 117 | */ |
| 118 | public function prepend($path, $data); |
| 119 | |
| 120 | /** |
| 121 | * Append to a file. |
| 122 | * |
| 123 | * @param string $path |
| 124 | * @param string $data |
| 125 | * @return bool |
| 126 | */ |
| 127 | public function append($path, $data); |
| 128 | |
| 129 | /** |
| 130 | * Delete the file at a given path. |
| 131 | * |
| 132 | * @param string|array $paths |
| 133 | * @return bool |
| 134 | */ |
| 135 | public function delete($paths); |
| 136 | |
| 137 | /** |
| 138 | * Copy a file to a new location. |
| 139 | * |
| 140 | * @param string $from |
| 141 | * @param string $to |
| 142 | * @return bool |
| 143 | */ |
| 144 | public function copy($from, $to); |
| 145 | |
| 146 | /** |
| 147 | * Move a file to a new location. |
| 148 | * |
| 149 | * @param string $from |
| 150 | * @param string $to |
| 151 | * @return bool |
| 152 | */ |
| 153 | public function move($from, $to); |
| 154 | |
| 155 | /** |
| 156 | * Get the file size of a given file. |
| 157 | * |
| 158 | * @param string $path |
| 159 | * @return int |
| 160 | */ |
| 161 | public function size($path); |
| 162 | |
| 163 | /** |
| 164 | * Get the file's last modification time. |
| 165 | * |
| 166 | * @param string $path |
| 167 | * @return int |
| 168 | */ |
| 169 | public function lastModified($path); |
| 170 | |
| 171 | /** |
| 172 | * Get an array of all files in a directory. |
| 173 | * |
| 174 | * @param string|null $directory |
| 175 | * @param bool $recursive |
| 176 | * @return array<string> |
| 177 | */ |
| 178 | public function files($directory = null, $recursive = false); |
| 179 | |
| 180 | /** |
| 181 | * Get all of the files from the given directory (recursive). |
| 182 | * |
| 183 | * @param string|null $directory |
| 184 | * @return array<string> |
| 185 | */ |
| 186 | public function allFiles($directory = null); |
| 187 | |
| 188 | /** |
| 189 | * Get all of the directories within a given directory. |
| 190 | * |
| 191 | * @param string|null $directory |
| 192 | * @param bool $recursive |
| 193 | * @return array<string> |
| 194 | */ |
| 195 | public function directories($directory = null, $recursive = false); |
| 196 | |
| 197 | /** |
| 198 | * Get all (recursive) of the directories within a given directory. |
| 199 | * |
| 200 | * @param string|null $directory |
| 201 | * @return array<string> |
| 202 | */ |
| 203 | public function allDirectories($directory = null); |
| 204 | |
| 205 | /** |
| 206 | * Create a directory. |
| 207 | * |
| 208 | * @param string $path |
| 209 | * @return bool |
| 210 | */ |
| 211 | public function makeDirectory($path); |
| 212 | |
| 213 | /** |
| 214 | * Recursively delete a directory. |
| 215 | * |
| 216 | * @param string $directory |
| 217 | * @return bool |
| 218 | */ |
| 219 | public function deleteDirectory($directory); |
| 220 | } |