1 | <?php |
||
29 | class NativeState { |
||
30 | /** |
||
31 | * @var resource |
||
32 | */ |
||
33 | protected $state; |
||
34 | |||
35 | protected $handlerSet = false; |
||
36 | |||
37 | protected $connected = false; |
||
38 | |||
39 | // see error.h |
||
40 | const EXCEPTION_MAP = [ |
||
41 | 1 => ForbiddenException::class, |
||
42 | 2 => NotFoundException::class, |
||
43 | 13 => ForbiddenException::class, |
||
44 | 16 => FileInUseException::class, |
||
45 | 17 => AlreadyExistsException::class, |
||
46 | 20 => InvalidTypeException::class, |
||
47 | 21 => InvalidTypeException::class, |
||
48 | 22 => InvalidArgumentException::class, |
||
49 | 28 => OutOfSpaceException::class, |
||
50 | 39 => NotEmptyException::class, |
||
51 | 110 => TimedOutException::class, |
||
52 | 111 => ConnectionRefusedException::class, |
||
53 | 112 => HostDownException::class, |
||
54 | 113 => NoRouteToHostException::class |
||
55 | ]; |
||
56 | |||
57 | protected function handleError($path) { |
||
64 | |||
65 | protected function testResult($result, $uri) { |
||
77 | |||
78 | /** |
||
79 | * @param IAuth $auth |
||
80 | * @param IOptions $options |
||
81 | * @return bool |
||
82 | */ |
||
83 | public function init(IAuth $auth, IOptions $options) { |
||
97 | |||
98 | /** |
||
99 | * @param string $uri |
||
100 | * @return resource |
||
101 | */ |
||
102 | public function opendir($uri) { |
||
108 | |||
109 | /** |
||
110 | * @param resource $dir |
||
111 | * @return array |
||
112 | */ |
||
113 | public function readdir($dir) { |
||
119 | |||
120 | /** |
||
121 | * @param $dir |
||
122 | * @return bool |
||
123 | */ |
||
124 | public function closedir($dir) { |
||
130 | |||
131 | /** |
||
132 | * @param string $old |
||
133 | * @param string $new |
||
134 | * @return bool |
||
135 | */ |
||
136 | public function rename($old, $new) { |
||
142 | |||
143 | /** |
||
144 | * @param string $uri |
||
145 | * @return bool |
||
146 | */ |
||
147 | public function unlink($uri) { |
||
153 | |||
154 | /** |
||
155 | * @param string $uri |
||
156 | * @param int $mask |
||
157 | * @return bool |
||
158 | */ |
||
159 | public function mkdir($uri, $mask = 0777) { |
||
165 | |||
166 | /** |
||
167 | * @param string $uri |
||
168 | * @return bool |
||
169 | */ |
||
170 | public function rmdir($uri) { |
||
176 | |||
177 | /** |
||
178 | * @param string $uri |
||
179 | * @return array |
||
180 | */ |
||
181 | public function stat($uri) { |
||
187 | |||
188 | /** |
||
189 | * @param resource $file |
||
190 | * @return array |
||
191 | */ |
||
192 | public function fstat($file) { |
||
198 | |||
199 | /** |
||
200 | * @param string $uri |
||
201 | * @param string $mode |
||
202 | * @param int $mask |
||
203 | * @return resource |
||
204 | */ |
||
205 | public function open($uri, $mode, $mask = 0666) { |
||
211 | |||
212 | /** |
||
213 | * @param string $uri |
||
214 | * @param int $mask |
||
215 | * @return resource |
||
216 | */ |
||
217 | public function create($uri, $mask = 0666) { |
||
223 | |||
224 | /** |
||
225 | * @param resource $file |
||
226 | * @param int $bytes |
||
227 | * @return string |
||
228 | */ |
||
229 | public function read($file, $bytes) { |
||
235 | |||
236 | /** |
||
237 | * @param resource $file |
||
238 | * @param string $data |
||
239 | * @param int $length |
||
240 | * @return int |
||
241 | */ |
||
242 | public function write($file, $data, $length = null) { |
||
248 | |||
249 | /** |
||
250 | * @param resource $file |
||
251 | * @param int $offset |
||
252 | * @param int $whence SEEK_SET | SEEK_CUR | SEEK_END |
||
253 | * @return int|bool new file offset as measured from the start of the file on success, false on failure. |
||
254 | */ |
||
255 | public function lseek($file, $offset, $whence = SEEK_SET) { |
||
261 | |||
262 | /** |
||
263 | * @param resource $file |
||
264 | * @param int $size |
||
265 | * @return bool |
||
266 | */ |
||
267 | public function ftruncate($file, $size) { |
||
273 | |||
274 | public function close($file) { |
||
280 | |||
281 | /** |
||
282 | * @param string $uri |
||
283 | * @param string $key |
||
284 | * @return string |
||
285 | */ |
||
286 | public function getxattr($uri, $key) { |
||
292 | |||
293 | /** |
||
294 | * @param string $uri |
||
295 | * @param string $key |
||
296 | * @param string $value |
||
297 | * @param int $flags |
||
298 | * @return mixed |
||
299 | */ |
||
300 | public function setxattr($uri, $key, $value, $flags = 0) { |
||
306 | |||
307 | public function __destruct() { |
||
312 | } |
||
313 |