Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | /** |
| 3 | * Pop PHP Framework (https://www.popphp.org/) |
| 4 | * |
| 5 | * @link https://github.com/popphp/popphp-framework |
| 6 | * @author Nick Sagona, III <dev@noladev.com> |
| 7 | * @copyright Copyright (c) 2009-2025 NOLA Interactive, LLC. |
| 8 | * @license https://www.popphp.org/license New BSD License |
| 9 | */ |
| 10 | |
| 11 | /** |
| 12 | * @namespace |
| 13 | */ |
| 14 | namespace Pop\Storage; |
| 15 | |
| 16 | /** |
| 17 | * Storage interface |
| 18 | * |
| 19 | * @category Pop |
| 20 | * @package Pop\Storage |
| 21 | * @author Nick Sagona, III <dev@noladev.com> |
| 22 | * @copyright Copyright (c) 2009-2025 NOLA Interactive, LLC. |
| 23 | * @license https://www.popphp.org/license New BSD License |
| 24 | * @version 2.1.0 |
| 25 | */ |
| 26 | interface StorageInterface |
| 27 | { |
| 28 | |
| 29 | /** |
| 30 | * Set base directory |
| 31 | * |
| 32 | * @param ?string $directory |
| 33 | * @return void |
| 34 | */ |
| 35 | public function setBaseDir(?string $directory = null): void; |
| 36 | |
| 37 | /** |
| 38 | * Get base directory |
| 39 | * |
| 40 | * @return ?string |
| 41 | */ |
| 42 | public function getBaseDir(): ?string; |
| 43 | |
| 44 | /** |
| 45 | * Get current directory |
| 46 | * |
| 47 | * @return ?string |
| 48 | */ |
| 49 | public function getCurrentDir(): ?string; |
| 50 | |
| 51 | /** |
| 52 | * Change directory |
| 53 | * |
| 54 | * @param ?string $directory |
| 55 | * @return void |
| 56 | */ |
| 57 | public function chdir(?string $directory = null): void; |
| 58 | |
| 59 | /** |
| 60 | * Make directory |
| 61 | * |
| 62 | * @param string $directory |
| 63 | * @return void |
| 64 | */ |
| 65 | public function mkdir(string $directory): void; |
| 66 | |
| 67 | /** |
| 68 | * Remove a directory |
| 69 | * |
| 70 | * @param string $directory |
| 71 | * @return void |
| 72 | */ |
| 73 | public function rmdir(string $directory): void; |
| 74 | |
| 75 | /** |
| 76 | * List all |
| 77 | * |
| 78 | * @param ?string $search |
| 79 | * @return array |
| 80 | */ |
| 81 | public function listAll(?string $search = null): array; |
| 82 | |
| 83 | /** |
| 84 | * List directories |
| 85 | * |
| 86 | * @param ?string $search |
| 87 | * @return array |
| 88 | */ |
| 89 | public function listDirs(?string $search = null): array; |
| 90 | |
| 91 | /** |
| 92 | * List files |
| 93 | * |
| 94 | * @param ?string $search |
| 95 | * @return array |
| 96 | */ |
| 97 | public function listFiles(?string $search = null): array; |
| 98 | |
| 99 | /** |
| 100 | * Put file |
| 101 | * |
| 102 | * @param string $fileFrom |
| 103 | * @param bool $copy |
| 104 | * @return void |
| 105 | */ |
| 106 | public function putFile(string $fileFrom, bool $copy = true): void; |
| 107 | |
| 108 | /** |
| 109 | * Put file contents |
| 110 | * |
| 111 | * @param string $filename |
| 112 | * @param string $fileContents |
| 113 | * @return void |
| 114 | */ |
| 115 | public function putFileContents(string $filename, string $fileContents): void; |
| 116 | |
| 117 | /** |
| 118 | * Upload file from server request $_FILES['file'] |
| 119 | * |
| 120 | * @param array $file |
| 121 | * @return void |
| 122 | */ |
| 123 | public function uploadFile(array $file): void; |
| 124 | |
| 125 | /** |
| 126 | * Copy file |
| 127 | * |
| 128 | * @param string $sourceFile |
| 129 | * @param string $destFile |
| 130 | * @return void |
| 131 | */ |
| 132 | public function copyFile(string $sourceFile, string $destFile): void; |
| 133 | |
| 134 | |
| 135 | /** |
| 136 | * Copy file to a location external to the current location |
| 137 | * |
| 138 | * @param string $sourceFile |
| 139 | * @param string $externalFile |
| 140 | * @return void |
| 141 | */ |
| 142 | public function copyFileToExternal(string $sourceFile, string $externalFile): void; |
| 143 | |
| 144 | |
| 145 | /** |
| 146 | * Copy file from a location external to the current location |
| 147 | * |
| 148 | * @param string $externalFile |
| 149 | * @param string $destFile |
| 150 | * @return void |
| 151 | */ |
| 152 | public function copyFileFromExternal(string $externalFile, string $destFile): void; |
| 153 | |
| 154 | /** |
| 155 | * Move file to a location external to the current location |
| 156 | * |
| 157 | * @param string $sourceFile |
| 158 | * @param string $externalFile |
| 159 | * @return void |
| 160 | */ |
| 161 | public function moveFileToExternal(string $sourceFile, string $externalFile): void; |
| 162 | |
| 163 | /** |
| 164 | * Move file from a location external to the current location |
| 165 | * |
| 166 | * @param string $externalFile |
| 167 | * @param string $destFile |
| 168 | * @return void |
| 169 | */ |
| 170 | public function moveFileFromExternal(string $externalFile, string $destFile): void; |
| 171 | |
| 172 | /** |
| 173 | * Rename file |
| 174 | * |
| 175 | * @param string $oldFile |
| 176 | * @param string $newFile |
| 177 | * @return void |
| 178 | */ |
| 179 | public function renameFile(string $oldFile, string $newFile): void; |
| 180 | |
| 181 | /** |
| 182 | * Replace file |
| 183 | * |
| 184 | * @param string $filename |
| 185 | * @param string $fileContents |
| 186 | * @return void |
| 187 | */ |
| 188 | public function replaceFileContents(string $filename, string $fileContents): void; |
| 189 | |
| 190 | /** |
| 191 | * Delete file |
| 192 | * |
| 193 | * @param string $filename |
| 194 | * @return void |
| 195 | */ |
| 196 | public function deleteFile(string $filename): void; |
| 197 | |
| 198 | /** |
| 199 | * Fetch file contents |
| 200 | * |
| 201 | * @param string $filename |
| 202 | * @return mixed |
| 203 | */ |
| 204 | public function fetchFile(string $filename): mixed; |
| 205 | |
| 206 | /** |
| 207 | * Fetch file info |
| 208 | * |
| 209 | * @param string $filename |
| 210 | * @return array |
| 211 | */ |
| 212 | public function fetchFileInfo(string $filename): array; |
| 213 | |
| 214 | /** |
| 215 | * File exists |
| 216 | * |
| 217 | * @param string $filename |
| 218 | * @return bool |
| 219 | */ |
| 220 | public function fileExists(string $filename): bool; |
| 221 | |
| 222 | /** |
| 223 | * Check if is a directory |
| 224 | * |
| 225 | * @param string $directory |
| 226 | * @return bool |
| 227 | */ |
| 228 | public function isDir(string $directory): bool; |
| 229 | |
| 230 | /** |
| 231 | * Check if is a file |
| 232 | * |
| 233 | * @param string $filename |
| 234 | * @return bool |
| 235 | */ |
| 236 | public function isFile(string $filename): bool; |
| 237 | |
| 238 | /** |
| 239 | * Get file size |
| 240 | * |
| 241 | * @param string $filename |
| 242 | * @return int|bool |
| 243 | */ |
| 244 | public function getFileSize(string $filename): int|bool; |
| 245 | |
| 246 | /** |
| 247 | * Get file type |
| 248 | * |
| 249 | * @param string $filename |
| 250 | * @return string|bool |
| 251 | */ |
| 252 | public function getFileType(string $filename): string|bool; |
| 253 | |
| 254 | /** |
| 255 | * Get file modified time |
| 256 | * |
| 257 | * @param string $filename |
| 258 | * @return int|string|bool |
| 259 | */ |
| 260 | public function getFileMTime(string $filename): int|string|bool; |
| 261 | |
| 262 | /** |
| 263 | * Create MD5 checksum of the file |
| 264 | * |
| 265 | * @param string $filename |
| 266 | * @return string|bool |
| 267 | */ |
| 268 | public function md5File(string $filename): string|bool; |
| 269 | |
| 270 | } |