Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame^] | 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 | * Determine if a file exists. |
| 23 | * |
| 24 | * @param string $path |
| 25 | * @return bool |
| 26 | */ |
| 27 | public function exists($path); |
| 28 | |
| 29 | /** |
| 30 | * Get the contents of a file. |
| 31 | * |
| 32 | * @param string $path |
| 33 | * @return string |
| 34 | * |
| 35 | * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException |
| 36 | */ |
| 37 | public function get($path); |
| 38 | |
| 39 | /** |
| 40 | * Get a resource to read the file. |
| 41 | * |
| 42 | * @param string $path |
| 43 | * @return resource|null The path resource or null on failure. |
| 44 | * |
| 45 | * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException |
| 46 | */ |
| 47 | public function readStream($path); |
| 48 | |
| 49 | /** |
| 50 | * Write the contents of a file. |
| 51 | * |
| 52 | * @param string $path |
| 53 | * @param string|resource $contents |
| 54 | * @param mixed $options |
| 55 | * @return bool |
| 56 | */ |
| 57 | public function put($path, $contents, $options = []); |
| 58 | |
| 59 | /** |
| 60 | * Write a new file using a stream. |
| 61 | * |
| 62 | * @param string $path |
| 63 | * @param resource $resource |
| 64 | * @param array $options |
| 65 | * @return bool |
| 66 | * |
| 67 | * @throws \InvalidArgumentException If $resource is not a file handle. |
| 68 | * @throws \Illuminate\Contracts\Filesystem\FileExistsException |
| 69 | */ |
| 70 | public function writeStream($path, $resource, array $options = []); |
| 71 | |
| 72 | /** |
| 73 | * Get the visibility for the given path. |
| 74 | * |
| 75 | * @param string $path |
| 76 | * @return string |
| 77 | */ |
| 78 | public function getVisibility($path); |
| 79 | |
| 80 | /** |
| 81 | * Set the visibility for the given path. |
| 82 | * |
| 83 | * @param string $path |
| 84 | * @param string $visibility |
| 85 | * @return bool |
| 86 | */ |
| 87 | public function setVisibility($path, $visibility); |
| 88 | |
| 89 | /** |
| 90 | * Prepend to a file. |
| 91 | * |
| 92 | * @param string $path |
| 93 | * @param string $data |
| 94 | * @return bool |
| 95 | */ |
| 96 | public function prepend($path, $data); |
| 97 | |
| 98 | /** |
| 99 | * Append to a file. |
| 100 | * |
| 101 | * @param string $path |
| 102 | * @param string $data |
| 103 | * @return bool |
| 104 | */ |
| 105 | public function append($path, $data); |
| 106 | |
| 107 | /** |
| 108 | * Delete the file at a given path. |
| 109 | * |
| 110 | * @param string|array $paths |
| 111 | * @return bool |
| 112 | */ |
| 113 | public function delete($paths); |
| 114 | |
| 115 | /** |
| 116 | * Copy a file to a new location. |
| 117 | * |
| 118 | * @param string $from |
| 119 | * @param string $to |
| 120 | * @return bool |
| 121 | */ |
| 122 | public function copy($from, $to); |
| 123 | |
| 124 | /** |
| 125 | * Move a file to a new location. |
| 126 | * |
| 127 | * @param string $from |
| 128 | * @param string $to |
| 129 | * @return bool |
| 130 | */ |
| 131 | public function move($from, $to); |
| 132 | |
| 133 | /** |
| 134 | * Get the file size of a given file. |
| 135 | * |
| 136 | * @param string $path |
| 137 | * @return int |
| 138 | */ |
| 139 | public function size($path); |
| 140 | |
| 141 | /** |
| 142 | * Get the file's last modification time. |
| 143 | * |
| 144 | * @param string $path |
| 145 | * @return int |
| 146 | */ |
| 147 | public function lastModified($path); |
| 148 | |
| 149 | /** |
| 150 | * Get an array of all files in a directory. |
| 151 | * |
| 152 | * @param string|null $directory |
| 153 | * @param bool $recursive |
| 154 | * @return array |
| 155 | */ |
| 156 | public function files($directory = null, $recursive = false); |
| 157 | |
| 158 | /** |
| 159 | * Get all of the files from the given directory (recursive). |
| 160 | * |
| 161 | * @param string|null $directory |
| 162 | * @return array |
| 163 | */ |
| 164 | public function allFiles($directory = null); |
| 165 | |
| 166 | /** |
| 167 | * Get all of the directories within a given directory. |
| 168 | * |
| 169 | * @param string|null $directory |
| 170 | * @param bool $recursive |
| 171 | * @return array |
| 172 | */ |
| 173 | public function directories($directory = null, $recursive = false); |
| 174 | |
| 175 | /** |
| 176 | * Get all (recursive) of the directories within a given directory. |
| 177 | * |
| 178 | * @param string|null $directory |
| 179 | * @return array |
| 180 | */ |
| 181 | public function allDirectories($directory = null); |
| 182 | |
| 183 | /** |
| 184 | * Create a directory. |
| 185 | * |
| 186 | * @param string $path |
| 187 | * @return bool |
| 188 | */ |
| 189 | public function makeDirectory($path); |
| 190 | |
| 191 | /** |
| 192 | * Recursively delete a directory. |
| 193 | * |
| 194 | * @param string $directory |
| 195 | * @return bool |
| 196 | */ |
| 197 | public function deleteDirectory($directory); |
| 198 | } |