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 | * |
4 | * This file is part of the phpBB Forum Software package. |
5 | * |
6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
7 | * @license GNU General Public License, version 2 (GPL-2.0) |
8 | * |
9 | * For full copyright and license information, please see |
10 | * the docs/CREDITS.txt file. |
11 | * |
12 | */ |
13 | |
14 | namespace phpbb\storage\adapter; |
15 | |
16 | use phpbb\storage\exception\storage_exception; |
17 | |
18 | interface adapter_interface |
19 | { |
20 | /** |
21 | * Set adapter parameters |
22 | * |
23 | * @param array $options options Storage-specific options. |
24 | */ |
25 | public function configure(array $options): void; |
26 | |
27 | /** |
28 | * Dumps content into a file |
29 | * |
30 | * @param string $path |
31 | * @param string $content |
32 | * @throws storage_exception When the file cannot be written |
33 | */ |
34 | public function put_contents(string $path, string $content): void; |
35 | |
36 | /** |
37 | * Read the contents of a file |
38 | * |
39 | * @param string $path The file to read |
40 | * |
41 | * @return string Returns file contents |
42 | * @throws storage_exception When cannot read file contents |
43 | */ |
44 | public function get_contents(string $path): string; |
45 | |
46 | /** |
47 | * Checks the existence of files or directories |
48 | * |
49 | * @param string $path file/directory to check |
50 | * |
51 | * @return bool Returns true if the file/directory exist, false otherwise. |
52 | */ |
53 | public function exists(string $path): bool; |
54 | |
55 | /** |
56 | * Removes files or directories |
57 | * |
58 | * @param string $path file/directory to remove |
59 | * |
60 | * @throws storage_exception When removal fails. |
61 | */ |
62 | public function delete(string $path): void; |
63 | |
64 | /** |
65 | * Rename a file or a directory |
66 | * |
67 | * @param string $path_orig The original file/direcotry |
68 | * @param string $path_dest The target file/directory |
69 | * |
70 | * @throws storage_exception When file/directory cannot be renamed |
71 | */ |
72 | public function rename(string $path_orig, string $path_dest): void; |
73 | |
74 | /** |
75 | * Copies a file |
76 | * |
77 | * @param string $path_orig The original filename |
78 | * @param string $path_dest The target filename |
79 | * |
80 | * @throws storage_exception When the file cannot be copied |
81 | */ |
82 | public function copy(string $path_orig, string $path_dest): void; |
83 | |
84 | /** |
85 | * Get file size in bytes |
86 | * |
87 | * @param string $path The file |
88 | * |
89 | * @return int Size in bytes. |
90 | * |
91 | * @throws storage_exception When unable to retrieve file size |
92 | */ |
93 | public function file_size(string $path): int; |
94 | |
95 | /** |
96 | * Get space available in bytes |
97 | * |
98 | * @return float Returns available space |
99 | * @throws storage_exception When unable to retrieve available storage space |
100 | */ |
101 | public function free_space(): float; |
102 | } |