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 | * Jingga |
4 | * |
5 | * PHP Version 8.1 |
6 | * |
7 | * @package phpOMS\System\File |
8 | * @copyright Dennis Eichhorn |
9 | * @license OMS License 2.0 |
10 | * @version 1.0.0 |
11 | * @link https://jingga.app |
12 | */ |
13 | declare(strict_types=1); |
14 | |
15 | namespace phpOMS\System\File\Local; |
16 | |
17 | use phpOMS\System\File\ContainerInterface; |
18 | |
19 | /** |
20 | * Filesystem class. |
21 | * |
22 | * Performing operations on the file system |
23 | * |
24 | * @package phpOMS\System\File |
25 | * @license OMS License 2.0 |
26 | * @link https://jingga.app |
27 | * @since 1.0.0 |
28 | */ |
29 | interface LocalContainerInterface extends ContainerInterface |
30 | { |
31 | /** |
32 | * Get the datetime when the resource got created. |
33 | * |
34 | * @param string $path Path of the resource |
35 | * |
36 | * @return \DateTime |
37 | * |
38 | * @since 1.0.0 |
39 | */ |
40 | public static function created(string $path) : \DateTime; |
41 | |
42 | /** |
43 | * Get the datetime when the resource got last modified. |
44 | * |
45 | * @param string $path Path of the resource |
46 | * |
47 | * @return \DateTime |
48 | * |
49 | * @since 1.0.0 |
50 | */ |
51 | public static function changed(string $path) : \DateTime; |
52 | |
53 | /** |
54 | * Get the owner id of the resource. |
55 | * |
56 | * @param string $path Path of the resource |
57 | * |
58 | * @return int |
59 | * |
60 | * @since 1.0.0 |
61 | */ |
62 | public static function owner(string $path) : int; |
63 | |
64 | /** |
65 | * Get the permissions id of the resource. |
66 | * |
67 | * @param string $path Path of the resource |
68 | * |
69 | * @return int Permissions (e.g. 0755); |
70 | * |
71 | * @since 1.0.0 |
72 | */ |
73 | public static function permission(string $path) : int; |
74 | |
75 | /** |
76 | * Get the parent path of the resource. |
77 | * |
78 | * The parent resource path is always a directory. |
79 | * |
80 | * @param string $path Path of the resource |
81 | * |
82 | * @return string |
83 | * |
84 | * @since 1.0.0 |
85 | */ |
86 | public static function parent(string $path) : string; |
87 | |
88 | /** |
89 | * Delete resource at destination path. |
90 | * |
91 | * @param string $path Path of the resource |
92 | * |
93 | * @return bool True on success and false on failure |
94 | * |
95 | * @since 1.0.0 |
96 | */ |
97 | public static function delete(string $path) : bool; |
98 | |
99 | /** |
100 | * Copy resource to different location. |
101 | * |
102 | * @param string $from Path of the resource to copy |
103 | * @param string $to Path of the resource to copy to |
104 | * @param bool $overwrite Overwrite/replace existing file |
105 | * |
106 | * @return bool True on success and false on failure |
107 | * |
108 | * @since 1.0.0 |
109 | */ |
110 | public static function copy(string $from, string $to, bool $overwrite = false) : bool; |
111 | |
112 | /** |
113 | * Move resource to different location. |
114 | * |
115 | * @param string $from Path of the resource to move |
116 | * @param string $to Path of the resource to move to |
117 | * @param bool $overwrite Overwrite/replace existing file |
118 | * |
119 | * @return bool True on success and false on failure |
120 | * |
121 | * @since 1.0.0 |
122 | */ |
123 | public static function move(string $from, string $to, bool $overwrite = false) : bool; |
124 | |
125 | /** |
126 | * Get size of resource. |
127 | * |
128 | * @param string $path Path of the resource |
129 | * @param bool $recursive Should include sub-sub-resources |
130 | * |
131 | * @return int |
132 | * |
133 | * @since 1.0.0 |
134 | */ |
135 | public static function size(string $path, bool $recursive = true) : int; |
136 | |
137 | /** |
138 | * Check existence of resource. |
139 | * |
140 | * @param string $path Path of the resource |
141 | * |
142 | * @return bool |
143 | * |
144 | * @since 1.0.0 |
145 | */ |
146 | public static function exists(string $path) : bool; |
147 | |
148 | /** |
149 | * Get name of resource. |
150 | * |
151 | * @param string $path Path of the resource |
152 | * |
153 | * @return string |
154 | * |
155 | * @since 1.0.0 |
156 | */ |
157 | public static function name(string $path) : string; |
158 | |
159 | /** |
160 | * Get basename of resource. |
161 | * |
162 | * @param string $path Path of the resource |
163 | * |
164 | * @return string |
165 | * |
166 | * @since 1.0.0 |
167 | */ |
168 | public static function basename(string $path) : string; |
169 | |
170 | /** |
171 | * Get the directory name of the resource. |
172 | * |
173 | * @param string $path Path of the resource |
174 | * |
175 | * @return string |
176 | * |
177 | * @since 1.0.0 |
178 | */ |
179 | public static function dirname(string $path) : string; |
180 | |
181 | /** |
182 | * Get the directory path of the resource. |
183 | * |
184 | * @param string $path Path of the resource |
185 | * |
186 | * @return string |
187 | * |
188 | * @since 1.0.0 |
189 | */ |
190 | public static function dirpath(string $path) : string; |
191 | |
192 | /** |
193 | * Count subresources. |
194 | * |
195 | * @param string $path Path of the resource |
196 | * @param bool $recursive Consider subdirectories |
197 | * @param string[] $ignore Files/paths to ignore (no regex) |
198 | * |
199 | * @return int |
200 | * |
201 | * @since 1.0.0 |
202 | */ |
203 | public static function count(string $path, bool $recursive = true, array $ignore = []) : int; |
204 | |
205 | /** |
206 | * Make name/path operating system safe. |
207 | * |
208 | * @param string $path Path of the resource |
209 | * @param string $replace Replace invalid chars with |
210 | * @param string $invalid Invalid chars to sanitize |
211 | * |
212 | * @return string |
213 | * |
214 | * @since 1.0.0 |
215 | */ |
216 | public static function sanitize(string $path, string $replace = '', string $invalid = '/[^\w\s\d\.\-_~,;\/\[\]\(\]]/') : string; |
217 | } |