1 | <?php |
||
15 | class NativeState { |
||
16 | /** |
||
17 | * @var resource |
||
18 | */ |
||
19 | protected $state; |
||
20 | |||
21 | protected $handlerSet = false; |
||
22 | |||
23 | protected $connected = false; |
||
24 | |||
25 | // todo replace with static once <5.6 support is dropped |
||
26 | // see error.h |
||
27 | private static $exceptionMap = [ |
||
28 | 1 => '\Icewind\SMB\Exception\ForbiddenException', |
||
29 | 2 => '\Icewind\SMB\Exception\NotFoundException', |
||
30 | 13 => '\Icewind\SMB\Exception\ForbiddenException', |
||
31 | 17 => '\Icewind\SMB\Exception\AlreadyExistsException', |
||
32 | 20 => '\Icewind\SMB\Exception\InvalidTypeException', |
||
33 | 21 => '\Icewind\SMB\Exception\InvalidTypeException', |
||
34 | 39 => '\Icewind\SMB\Exception\NotEmptyException', |
||
35 | 110 => '\Icewind\SMB\Exception\TimedOutException', |
||
36 | 111 => '\Icewind\SMB\Exception\ConnectionRefusedException', |
||
37 | 112 => '\Icewind\SMB\Exception\HostDownException', |
||
38 | 113 => '\Icewind\SMB\Exception\NoRouteToHostException' |
||
39 | ]; |
||
40 | |||
41 | 508 | protected function handleError($path) { |
|
48 | |||
49 | 508 | protected function testResult($result, $uri) { |
|
61 | |||
62 | /** |
||
63 | * @param string $workGroup |
||
64 | * @param string $user |
||
65 | * @param string $password |
||
66 | * @return bool |
||
67 | */ |
||
68 | 508 | public function init($workGroup, $user, $password) { |
|
79 | |||
80 | /** |
||
81 | * @param string $uri |
||
82 | * @return resource |
||
83 | */ |
||
84 | 508 | public function opendir($uri) { |
|
90 | |||
91 | /** |
||
92 | * @param resource $dir |
||
93 | * @return array |
||
94 | */ |
||
95 | 508 | public function readdir($dir) { |
|
101 | |||
102 | /** |
||
103 | * @param $dir |
||
104 | * @return bool |
||
105 | */ |
||
106 | 508 | public function closedir($dir) { |
|
112 | |||
113 | /** |
||
114 | * @param string $old |
||
115 | * @param string $new |
||
116 | * @return bool |
||
117 | */ |
||
118 | 36 | public function rename($old, $new) { |
|
124 | |||
125 | /** |
||
126 | * @param string $uri |
||
127 | * @return bool |
||
128 | */ |
||
129 | 248 | public function unlink($uri) { |
|
135 | |||
136 | /** |
||
137 | * @param string $uri |
||
138 | * @param int $mask |
||
139 | * @return bool |
||
140 | */ |
||
141 | 508 | public function mkdir($uri, $mask = 0777) { |
|
147 | |||
148 | /** |
||
149 | * @param string $uri |
||
150 | * @return bool |
||
151 | */ |
||
152 | 508 | public function rmdir($uri) { |
|
158 | |||
159 | /** |
||
160 | * @param string $uri |
||
161 | * @return array |
||
162 | */ |
||
163 | 240 | public function stat($uri) { |
|
169 | |||
170 | /** |
||
171 | * @param resource $file |
||
172 | * @return array |
||
173 | */ |
||
174 | public function fstat($file) { |
||
180 | |||
181 | /** |
||
182 | * @param string $uri |
||
183 | * @param string $mode |
||
184 | * @param int $mask |
||
185 | * @return resource |
||
186 | */ |
||
187 | 108 | public function open($uri, $mode, $mask = 0666) { |
|
193 | |||
194 | /** |
||
195 | * @param string $uri |
||
196 | * @param int $mask |
||
197 | * @return resource |
||
198 | */ |
||
199 | 248 | public function create($uri, $mask = 0666) { |
|
205 | |||
206 | /** |
||
207 | * @param resource $file |
||
208 | * @param int $bytes |
||
209 | * @return string |
||
210 | */ |
||
211 | 102 | public function read($file, $bytes) { |
|
217 | |||
218 | /** |
||
219 | * @param resource $file |
||
220 | * @param string $data |
||
221 | * @param int $length |
||
222 | * @return int |
||
223 | */ |
||
224 | 240 | public function write($file, $data, $length = null) { |
|
230 | |||
231 | /** |
||
232 | * @param resource $file |
||
233 | * @param int $offset |
||
234 | * @param int $whence SEEK_SET | SEEK_CUR | SEEK_END |
||
235 | * @return int | bool new file offset as measured from the start of the file on success, false on failure. |
||
236 | */ |
||
237 | 2 | public function lseek($file, $offset, $whence = SEEK_SET) { |
|
243 | |||
244 | /** |
||
245 | * @param resource $file |
||
246 | * @param int $size |
||
247 | * @return bool |
||
248 | */ |
||
249 | 2 | public function ftruncate($file, $size) { |
|
255 | |||
256 | 244 | public function close($file) { |
|
262 | |||
263 | /** |
||
264 | * @param string $uri |
||
265 | * @param string $key |
||
266 | * @return string |
||
267 | */ |
||
268 | 28 | public function getxattr($uri, $key) { |
|
274 | |||
275 | /** |
||
276 | * @param string $uri |
||
277 | * @param string $key |
||
278 | * @param string $value |
||
279 | * @param int $flags |
||
280 | * @return mixed |
||
281 | */ |
||
282 | 16 | public function setxattr($uri, $key, $value, $flags = 0) { |
|
288 | |||
289 | 508 | public function __destruct() { |
|
294 | } |
||
295 |