1 | <?php |
||
31 | class NativeState { |
||
32 | /** @var resource|null */ |
||
33 | protected $state = null; |
||
34 | |||
35 | /** @var bool */ |
||
36 | protected $handlerSet = false; |
||
37 | |||
38 | /** @var bool */ |
||
39 | protected $connected = false; |
||
40 | |||
41 | // see error.h |
||
42 | const EXCEPTION_MAP = [ |
||
43 | 1 => ForbiddenException::class, |
||
44 | 2 => NotFoundException::class, |
||
45 | 13 => ForbiddenException::class, |
||
46 | 16 => FileInUseException::class, |
||
47 | 17 => AlreadyExistsException::class, |
||
48 | 20 => InvalidTypeException::class, |
||
49 | 21 => InvalidTypeException::class, |
||
50 | 22 => InvalidArgumentException::class, |
||
51 | 28 => OutOfSpaceException::class, |
||
52 | 39 => NotEmptyException::class, |
||
53 | 103 => ConnectionAbortedException::class, |
||
54 | 104 => ConnectionResetException::class, |
||
55 | 110 => TimedOutException::class, |
||
56 | 111 => ConnectionRefusedException::class, |
||
57 | 112 => HostDownException::class, |
||
58 | 113 => NoRouteToHostException::class |
||
59 | ]; |
||
60 | |||
61 | 494 | protected function handleError(?string $path): void { |
|
69 | 494 | ||
70 | 494 | /** |
|
71 | * @param mixed $result |
||
72 | 494 | * @param string|null $uri |
|
73 | 36 | * @throws Exception |
|
74 | 36 | */ |
|
75 | protected function testResult($result, ?string $uri): void { |
||
87 | 494 | ||
88 | 494 | /** |
|
89 | * @param IAuth $auth |
||
90 | * @param IOptions $options |
||
91 | 494 | * @return bool |
|
92 | 494 | */ |
|
93 | 494 | public function init(IAuth $auth, IOptions $options) { |
|
117 | 494 | ||
118 | 494 | /** |
|
119 | * @param string $uri |
||
120 | 494 | * @return resource |
|
121 | 494 | */ |
|
122 | public function opendir(string $uri) { |
||
129 | 494 | ||
130 | /** |
||
131 | 494 | * @param resource $dir |
|
132 | 494 | * @param string $path |
|
133 | * @return array{"type": string, "comment": string, "name": string}|false |
||
|
|||
134 | */ |
||
135 | public function readdir($dir, string $path) { |
||
142 | |||
143 | 38 | /** |
|
144 | 32 | * @param resource $dir |
|
145 | * @param string $path |
||
146 | * @return bool |
||
147 | */ |
||
148 | public function closedir($dir, string $path): bool { |
||
155 | 230 | ||
156 | /** |
||
157 | * @param string $old |
||
158 | * @param string $new |
||
159 | * @return bool |
||
160 | */ |
||
161 | public function rename(string $old, string $new): bool { |
||
168 | |||
169 | /** |
||
170 | * @param string $uri |
||
171 | * @return bool |
||
172 | */ |
||
173 | public function unlink(string $uri): bool { |
||
180 | |||
181 | /** |
||
182 | * @param string $uri |
||
183 | * @param int $mask |
||
184 | * @return bool |
||
185 | 36 | */ |
|
186 | 36 | public function mkdir(string $uri, int $mask = 0777): bool { |
|
193 | |||
194 | /** |
||
195 | * @param string $uri |
||
196 | * @return bool |
||
197 | */ |
||
198 | public function rmdir(string $uri): bool { |
||
205 | |||
206 | /** |
||
207 | * @param string $uri |
||
208 | * @return array{"mtime": int, "size": int, "mode": int} |
||
209 | 112 | */ |
|
210 | 112 | public function stat(string $uri): array { |
|
217 | |||
218 | /** |
||
219 | * @param resource $file |
||
220 | * @param string $path |
||
221 | 232 | * @return array{"mtime": int, "size": int, "mode": int} |
|
222 | 232 | */ |
|
223 | public function fstat($file, string $path): array { |
||
230 | |||
231 | /** |
||
232 | * @param string $uri |
||
233 | 104 | * @param string $mode |
|
234 | 104 | * @param int $mask |
|
235 | * @return resource |
||
236 | 104 | */ |
|
237 | 104 | public function open(string $uri, string $mode, int $mask = 0666) { |
|
244 | |||
245 | /** |
||
246 | * @param string $uri |
||
247 | 230 | * @param int $mask |
|
248 | 230 | * @return resource |
|
249 | */ |
||
250 | 230 | public function create(string $uri, int $mask = 0666) { |
|
257 | |||
258 | /** |
||
259 | * @param resource $file |
||
260 | 4 | * @param int $bytes |
|
261 | 4 | * @param string $path |
|
262 | * @return string |
||
263 | 4 | */ |
|
264 | 4 | public function read($file, int $bytes, string $path): string { |
|
271 | |||
272 | 2 | /** |
|
273 | 2 | * @param resource $file |
|
274 | * @param string $data |
||
275 | 2 | * @param string $path |
|
276 | 2 | * @param int|null $length |
|
277 | * @return int |
||
278 | */ |
||
279 | 230 | public function write($file, string $data, string $path, ?int $length = null): int { |
|
286 | |||
287 | /** |
||
288 | * @param resource $file |
||
289 | * @param int $offset |
||
290 | * @param int $whence SEEK_SET | SEEK_CUR | SEEK_END |
||
291 | 192 | * @param string|null $path |
|
292 | 192 | * @return int|false new file offset as measured from the start of the file on success. |
|
293 | */ |
||
294 | 192 | public function lseek($file, int $offset, int $whence = SEEK_SET, string $path = null) { |
|
301 | |||
302 | /** |
||
303 | * @param resource $file |
||
304 | * @param int $size |
||
305 | * @param string $path |
||
306 | * @return bool |
||
307 | */ |
||
308 | public function ftruncate($file, int $size, string $path): bool { |
||
315 | |||
316 | 496 | /** |
|
317 | * @param resource $file |
||
318 | * @param string $path |
||
319 | * @return bool |
||
320 | */ |
||
321 | public function close($file, string $path): bool { |
||
328 | |||
329 | /** |
||
330 | * @param string $uri |
||
331 | * @param string $key |
||
332 | * @return string |
||
333 | */ |
||
334 | public function getxattr(string $uri, string $key) { |
||
341 | |||
342 | /** |
||
343 | * @param string $uri |
||
344 | * @param string $key |
||
345 | * @param string $value |
||
346 | * @param int $flags |
||
347 | * @return bool |
||
348 | */ |
||
349 | public function setxattr(string $uri, string $key, string $value, int $flags = 0) { |
||
356 | |||
357 | public function __destruct() { |
||
364 | } |
||
365 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.