1 | <?php |
||
19 | class NativeShare extends AbstractShare { |
||
20 | /** |
||
21 | * @var IServer $server |
||
22 | */ |
||
23 | private $server; |
||
24 | |||
25 | /** |
||
26 | * @var string $name |
||
27 | */ |
||
28 | private $name; |
||
29 | |||
30 | /** |
||
31 | * @var NativeState $state |
||
32 | */ |
||
33 | private $state; |
||
34 | |||
35 | /** |
||
36 | * @param IServer $server |
||
37 | * @param string $name |
||
38 | */ |
||
39 | 494 | public function __construct($server, $name) { |
|
44 | |||
45 | /** |
||
46 | * @throws \Icewind\SMB\Exception\ConnectionException |
||
47 | * @throws \Icewind\SMB\Exception\AuthenticationException |
||
48 | * @throws \Icewind\SMB\Exception\InvalidHostException |
||
49 | */ |
||
50 | 494 | protected function getState() { |
|
59 | |||
60 | /** |
||
61 | * Get the name of the share |
||
62 | * |
||
63 | * @return string |
||
64 | */ |
||
65 | 2 | public function getName() { |
|
68 | |||
69 | 494 | private function buildUrl($path) { |
|
79 | |||
80 | /** |
||
81 | * List the content of a remote folder |
||
82 | * |
||
83 | * @param string $path |
||
84 | * @return \Icewind\SMB\IFileInfo[] |
||
85 | * |
||
86 | * @throws \Icewind\SMB\Exception\NotFoundException |
||
87 | * @throws \Icewind\SMB\Exception\InvalidTypeException |
||
88 | */ |
||
89 | 494 | public function dir($path) { |
|
104 | |||
105 | /** |
||
106 | * @param string $path |
||
107 | * @return \Icewind\SMB\IFileInfo |
||
108 | */ |
||
109 | 50 | public function stat($path) { |
|
117 | |||
118 | /** |
||
119 | * Multibyte unicode safe version of basename() |
||
120 | * |
||
121 | * @param string $path |
||
122 | * @link http://php.net/manual/en/function.basename.php#121405 |
||
123 | * @return string |
||
124 | */ |
||
125 | 50 | protected static function mb_basename($path) { |
|
134 | |||
135 | /** |
||
136 | * Create a folder on the share |
||
137 | * |
||
138 | * @param string $path |
||
139 | * @return bool |
||
140 | * |
||
141 | * @throws \Icewind\SMB\Exception\NotFoundException |
||
142 | * @throws \Icewind\SMB\Exception\AlreadyExistsException |
||
143 | */ |
||
144 | 494 | public function mkdir($path) { |
|
147 | |||
148 | /** |
||
149 | * Remove a folder on the share |
||
150 | * |
||
151 | * @param string $path |
||
152 | * @return bool |
||
153 | * |
||
154 | * @throws \Icewind\SMB\Exception\NotFoundException |
||
155 | * @throws \Icewind\SMB\Exception\InvalidTypeException |
||
156 | */ |
||
157 | 494 | public function rmdir($path) { |
|
160 | |||
161 | /** |
||
162 | * Delete a file on the share |
||
163 | * |
||
164 | * @param string $path |
||
165 | * @return bool |
||
166 | * |
||
167 | * @throws \Icewind\SMB\Exception\NotFoundException |
||
168 | * @throws \Icewind\SMB\Exception\InvalidTypeException |
||
169 | */ |
||
170 | 250 | public function del($path) { |
|
173 | |||
174 | /** |
||
175 | * Rename a remote file |
||
176 | * |
||
177 | * @param string $from |
||
178 | * @param string $to |
||
179 | * @return bool |
||
180 | * |
||
181 | * @throws \Icewind\SMB\Exception\NotFoundException |
||
182 | * @throws \Icewind\SMB\Exception\AlreadyExistsException |
||
183 | */ |
||
184 | 56 | public function rename($from, $to) { |
|
187 | |||
188 | /** |
||
189 | * Upload a local file |
||
190 | * |
||
191 | * @param string $source local file |
||
192 | * @param string $target remove file |
||
193 | * @return bool |
||
194 | * |
||
195 | * @throws \Icewind\SMB\Exception\NotFoundException |
||
196 | * @throws \Icewind\SMB\Exception\InvalidTypeException |
||
197 | */ |
||
198 | 210 | public function put($source, $target) { |
|
210 | |||
211 | /** |
||
212 | * Download a remote file |
||
213 | * |
||
214 | * @param string $source remove file |
||
215 | * @param string $target local file |
||
216 | * @return bool |
||
217 | * |
||
218 | * @throws \Icewind\SMB\Exception\NotFoundException |
||
219 | * @throws \Icewind\SMB\Exception\InvalidTypeException |
||
220 | * @throws \Icewind\SMB\Exception\InvalidPathException |
||
221 | * @throws \Icewind\SMB\Exception\InvalidResourceException |
||
222 | */ |
||
223 | 90 | public function get($source, $target) { |
|
251 | |||
252 | /** |
||
253 | * Open a readable stream to a remote file |
||
254 | * |
||
255 | * @param string $source |
||
256 | * @return resource a read only stream with the contents of the remote file |
||
257 | * |
||
258 | * @throws \Icewind\SMB\Exception\NotFoundException |
||
259 | * @throws \Icewind\SMB\Exception\InvalidTypeException |
||
260 | */ |
||
261 | 58 | public function read($source) { |
|
266 | |||
267 | /** |
||
268 | * Open a writeable stream to a remote file |
||
269 | * Note: This method will truncate the file to 0bytes first |
||
270 | * |
||
271 | * @param string $source |
||
272 | * @return resource a writeable stream |
||
273 | * |
||
274 | * @throws \Icewind\SMB\Exception\NotFoundException |
||
275 | * @throws \Icewind\SMB\Exception\InvalidTypeException |
||
276 | */ |
||
277 | 58 | public function write($source) { |
|
282 | |||
283 | /** |
||
284 | * Open a writeable stream and set the cursor to the end of the stream |
||
285 | * |
||
286 | * @param string $source |
||
287 | * @return resource a writeable stream |
||
288 | * |
||
289 | * @throws \Icewind\SMB\Exception\NotFoundException |
||
290 | * @throws \Icewind\SMB\Exception\InvalidTypeException |
||
291 | */ |
||
292 | 2 | public function append($source) { |
|
297 | |||
298 | /** |
||
299 | * Get extended attributes for the path |
||
300 | * |
||
301 | * @param string $path |
||
302 | * @param string $attribute attribute to get the info |
||
303 | * @return string the attribute value |
||
304 | */ |
||
305 | 210 | public function getAttribute($path, $attribute) { |
|
308 | |||
309 | /** |
||
310 | * Set extended attributes for the given path |
||
311 | * |
||
312 | * @param string $path |
||
313 | * @param string $attribute attribute to get the info |
||
314 | * @param string|int $value |
||
315 | * @return mixed the attribute value |
||
316 | */ |
||
317 | public function setAttribute($path, $attribute, $value) { |
||
324 | |||
325 | /** |
||
326 | * Set DOS comaptible node mode |
||
327 | * |
||
328 | * @param string $path |
||
329 | * @param int $mode a combination of FileInfo::MODE_READONLY, FileInfo::MODE_ARCHIVE, FileInfo::MODE_SYSTEM and FileInfo::MODE_HIDDEN, FileInfo::NORMAL |
||
330 | * @return mixed |
||
331 | */ |
||
332 | public function setMode($path, $mode) { |
||
335 | |||
336 | /** |
||
337 | * Start smb notify listener |
||
338 | * Note: This is a blocking call |
||
339 | * |
||
340 | * @param string $path |
||
341 | * @return INotifyHandler |
||
342 | */ |
||
343 | public function notify($path) { |
||
352 | |||
353 | public function getServer(): IServer { |
||
356 | |||
357 | 494 | public function __destruct() { |
|
360 | } |
||
361 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: