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) { |
|
45 | |||
46 | 508 | protected function testResult($result, $uri) { |
|
58 | |||
59 | /** |
||
60 | * @param string $workGroup |
||
61 | * @param string $user |
||
62 | * @param string $password |
||
63 | * @return bool |
||
64 | */ |
||
65 | 508 | public function init($workGroup, $user, $password) { |
|
76 | |||
77 | /** |
||
78 | * @param string $uri |
||
79 | * @return resource |
||
80 | */ |
||
81 | 508 | public function opendir($uri) { |
|
87 | |||
88 | /** |
||
89 | * @param resource $dir |
||
90 | * @return array |
||
91 | */ |
||
92 | 508 | public function readdir($dir) { |
|
98 | |||
99 | /** |
||
100 | * @param $dir |
||
101 | * @return bool |
||
102 | */ |
||
103 | public function closedir($dir) { |
||
109 | |||
110 | /** |
||
111 | * @param string $old |
||
112 | * @param string $new |
||
113 | * @return bool |
||
114 | */ |
||
115 | 36 | public function rename($old, $new) { |
|
121 | |||
122 | /** |
||
123 | * @param string $uri |
||
124 | * @return bool |
||
125 | */ |
||
126 | 86 | public function unlink($uri) { |
|
132 | |||
133 | /** |
||
134 | * @param string $uri |
||
135 | * @param int $mask |
||
136 | * @return bool |
||
137 | */ |
||
138 | 508 | public function mkdir($uri, $mask = 0777) { |
|
144 | |||
145 | /** |
||
146 | * @param string $uri |
||
147 | * @return bool |
||
148 | */ |
||
149 | 26 | public function rmdir($uri) { |
|
155 | |||
156 | /** |
||
157 | * @param string $uri |
||
158 | * @return array |
||
159 | */ |
||
160 | 84 | public function stat($uri) { |
|
166 | |||
167 | /** |
||
168 | * @param resource $file |
||
169 | * @return array |
||
170 | */ |
||
171 | public function fstat($file) { |
||
177 | |||
178 | /** |
||
179 | * @param string $uri |
||
180 | * @param string $mode |
||
181 | * @param int $mask |
||
182 | * @return resource |
||
183 | */ |
||
184 | 108 | public function open($uri, $mode, $mask = 0666) { |
|
190 | |||
191 | /** |
||
192 | * @param string $uri |
||
193 | * @param int $mask |
||
194 | * @return resource |
||
195 | */ |
||
196 | 248 | public function create($uri, $mask = 0666) { |
|
202 | |||
203 | /** |
||
204 | * @param resource $file |
||
205 | * @param int $bytes |
||
206 | * @return string |
||
207 | */ |
||
208 | 102 | public function read($file, $bytes) { |
|
214 | |||
215 | /** |
||
216 | * @param resource $file |
||
217 | * @param string $data |
||
218 | * @param int $length |
||
219 | * @return int |
||
220 | */ |
||
221 | 240 | public function write($file, $data, $length = null) { |
|
227 | |||
228 | /** |
||
229 | * @param resource $file |
||
230 | * @param int $offset |
||
231 | * @param int $whence SEEK_SET | SEEK_CUR | SEEK_END |
||
232 | * @return int | bool new file offset as measured from the start of the file on success, false on failure. |
||
233 | */ |
||
234 | 2 | public function lseek($file, $offset, $whence = SEEK_SET) { |
|
240 | |||
241 | /** |
||
242 | * @param resource $file |
||
243 | * @param int $size |
||
244 | * @return bool |
||
245 | */ |
||
246 | 2 | public function ftruncate($file, $size) { |
|
252 | |||
253 | 244 | public function close($file) { |
|
259 | |||
260 | /** |
||
261 | * @param string $uri |
||
262 | * @param string $key |
||
263 | * @return string |
||
264 | */ |
||
265 | 26 | public function getxattr($uri, $key) { |
|
271 | |||
272 | /** |
||
273 | * @param string $uri |
||
274 | * @param string $key |
||
275 | * @param string $value |
||
276 | * @param int $flags |
||
277 | * @return mixed |
||
278 | */ |
||
279 | 16 | public function setxattr($uri, $key, $value, $flags = 0) { |
|
285 | |||
286 | 496 | public function __destruct() { |
|
291 | } |
||
292 |