1 | <?php |
||
26 | class NativeShare extends AbstractShare { |
||
27 | /** |
||
28 | * @var IServer $server |
||
29 | */ |
||
30 | private $server; |
||
31 | |||
32 | /** |
||
33 | * @var string $name |
||
34 | */ |
||
35 | private $name; |
||
36 | |||
37 | /** |
||
38 | * @var ?NativeState $state |
||
|
|||
39 | 494 | */ |
|
40 | 494 | private $state; |
|
41 | 494 | ||
42 | 494 | public function __construct(IServer $server, string $name) { |
|
47 | |||
48 | /** |
||
49 | * @throws ConnectionException |
||
50 | 494 | * @throws AuthenticationException |
|
51 | 494 | * @throws InvalidHostException |
|
52 | 494 | */ |
|
53 | protected function getState(): NativeState { |
||
62 | |||
63 | /** |
||
64 | * Get the name of the share |
||
65 | 2 | * |
|
66 | 2 | * @return string |
|
67 | */ |
||
68 | public function getName(): string { |
||
71 | 494 | ||
72 | 494 | private function buildUrl(string $path): string { |
|
82 | |||
83 | /** |
||
84 | * List the content of a remote folder |
||
85 | * |
||
86 | * @param string $path |
||
87 | * @return IFileInfo[] |
||
88 | * |
||
89 | 494 | * @throws NotFoundException |
|
90 | 494 | * @throws InvalidTypeException |
|
91 | */ |
||
92 | 494 | public function dir(string $path): array { |
|
107 | |||
108 | /** |
||
109 | 50 | * @param string $path |
|
110 | 50 | * @return IFileInfo |
|
111 | */ |
||
112 | public function stat(string $path): IFileInfo { |
||
120 | |||
121 | /** |
||
122 | * Multibyte unicode safe version of basename() |
||
123 | * |
||
124 | * @param string $path |
||
125 | 50 | * @link http://php.net/manual/en/function.basename.php#121405 |
|
126 | 50 | * @return string |
|
127 | 30 | */ |
|
128 | 20 | protected static function mb_basename(string $path): string { |
|
137 | |||
138 | /** |
||
139 | * Create a folder on the share |
||
140 | * |
||
141 | * @param string $path |
||
142 | * @return bool |
||
143 | * |
||
144 | 494 | * @throws NotFoundException |
|
145 | 494 | * @throws AlreadyExistsException |
|
146 | */ |
||
147 | public function mkdir(string $path): bool { |
||
150 | |||
151 | /** |
||
152 | * Remove a folder on the share |
||
153 | * |
||
154 | * @param string $path |
||
155 | * @return bool |
||
156 | * |
||
157 | 494 | * @throws NotFoundException |
|
158 | 494 | * @throws InvalidTypeException |
|
159 | */ |
||
160 | public function rmdir(string $path): bool { |
||
163 | |||
164 | /** |
||
165 | * Delete a file on the share |
||
166 | * |
||
167 | * @param string $path |
||
168 | * @return bool |
||
169 | * |
||
170 | 250 | * @throws NotFoundException |
|
171 | 250 | * @throws InvalidTypeException |
|
172 | */ |
||
173 | public function del(string $path): bool { |
||
176 | |||
177 | /** |
||
178 | * Rename a remote file |
||
179 | * |
||
180 | * @param string $from |
||
181 | * @param string $to |
||
182 | * @return bool |
||
183 | * |
||
184 | 56 | * @throws NotFoundException |
|
185 | 56 | * @throws AlreadyExistsException |
|
186 | */ |
||
187 | public function rename(string $from, string $to): bool{ |
||
190 | |||
191 | /** |
||
192 | * Upload a local file |
||
193 | * |
||
194 | * @param string $source local file |
||
195 | * @param string $target remove file |
||
196 | * @return bool |
||
197 | * |
||
198 | 210 | * @throws NotFoundException |
|
199 | 210 | * @throws InvalidTypeException |
|
200 | 210 | */ |
|
201 | public function put(string $source, string $target): bool { |
||
213 | |||
214 | /** |
||
215 | * Download a remote file |
||
216 | * |
||
217 | * @param string $source remove file |
||
218 | * @param string $target local file |
||
219 | * @return bool |
||
220 | * |
||
221 | * @throws AuthenticationException |
||
222 | * @throws ConnectionException |
||
223 | 90 | * @throws InvalidHostException |
|
224 | 90 | * @throws InvalidPathException |
|
225 | 18 | * @throws InvalidResourceException |
|
226 | */ |
||
227 | public function get(string $source, string $target): bool { |
||
252 | |||
253 | /** |
||
254 | * Open a readable stream to a remote file |
||
255 | * |
||
256 | * @param string $source |
||
257 | * @return resource a read only stream with the contents of the remote file |
||
258 | * |
||
259 | * @throws NotFoundException |
||
260 | * @throws InvalidTypeException |
||
261 | 58 | */ |
|
262 | 58 | public function read(string $source) { |
|
267 | |||
268 | /** |
||
269 | * Open a writeable stream to a remote file |
||
270 | * Note: This method will truncate the file to 0bytes first |
||
271 | * |
||
272 | * @param string $source |
||
273 | * @return resource a writeable stream |
||
274 | * |
||
275 | * @throws NotFoundException |
||
276 | * @throws InvalidTypeException |
||
277 | 58 | */ |
|
278 | 58 | public function write(string $source) { |
|
283 | |||
284 | /** |
||
285 | * Open a writeable stream and set the cursor to the end of the stream |
||
286 | * |
||
287 | * @param string $source |
||
288 | * @return resource a writeable stream |
||
289 | * |
||
290 | * @throws NotFoundException |
||
291 | * @throws InvalidTypeException |
||
292 | 2 | */ |
|
293 | 2 | public function append(string $source) { |
|
298 | |||
299 | /** |
||
300 | * Get extended attributes for the path |
||
301 | * |
||
302 | * @param string $path |
||
303 | * @param string $attribute attribute to get the info |
||
304 | * @return string the attribute value |
||
305 | 210 | */ |
|
306 | 210 | public function getAttribute(string $path, string $attribute): string { |
|
309 | |||
310 | /** |
||
311 | * Set extended attributes for the given path |
||
312 | * |
||
313 | * @param string $path |
||
314 | * @param string $attribute attribute to get the info |
||
315 | * @param string|int $value |
||
316 | * @return mixed the attribute value |
||
317 | */ |
||
318 | public function setAttribute(string $path, string $attribute, $value) { |
||
329 | |||
330 | /** |
||
331 | * Set DOS comaptible node mode |
||
332 | * |
||
333 | * @param string $path |
||
334 | * @param int $mode a combination of FileInfo::MODE_READONLY, FileInfo::MODE_ARCHIVE, FileInfo::MODE_SYSTEM and FileInfo::MODE_HIDDEN, FileInfo::NORMAL |
||
335 | * @return mixed |
||
336 | */ |
||
337 | public function setMode(string $path, int $mode) { |
||
340 | |||
341 | /** |
||
342 | * Start smb notify listener |
||
343 | * Note: This is a blocking call |
||
344 | * |
||
345 | * @param string $path |
||
346 | * @return INotifyHandler |
||
347 | */ |
||
348 | public function notify(string $path): INotifyHandler { |
||
357 | 494 | ||
358 | 494 | public function getServer(): IServer { |
|
361 | |||
362 | public function __destruct() { |
||
365 | } |
||
366 |
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.