1 | <?php |
||
19 | class QiniuAdapter extends AbstractAdapter |
||
20 | { |
||
21 | use NotSupportingVisibilityTrait; |
||
22 | |||
23 | protected $accessKey; |
||
24 | protected $secretKey; |
||
25 | protected $bucket; |
||
26 | protected $domain; |
||
27 | |||
28 | protected $authManager; |
||
29 | protected $uploadManager; |
||
30 | protected $bucketManager; |
||
31 | |||
32 | /** |
||
33 | * QiniuAdapter constructor. |
||
34 | * |
||
35 | * @param string $accessKey |
||
36 | * @param string $secretKey |
||
37 | * @param string $bucket |
||
38 | * @param string $domain |
||
39 | */ |
||
40 | 1 | public function __construct($accessKey, $secretKey, $bucket, $domain) |
|
47 | |||
48 | /** |
||
49 | * Write a new file. |
||
50 | * |
||
51 | * @param string $path |
||
52 | * @param string $contents |
||
53 | * @param Config $config Config object |
||
54 | * |
||
55 | * @return array|false false on failure file meta data on success |
||
56 | */ |
||
57 | 1 | public function write($path, $contents, Config $config) |
|
71 | |||
72 | /** |
||
73 | * Write a new file using a stream. |
||
74 | * |
||
75 | * @param string $path |
||
76 | * @param resource $resource |
||
77 | * @param Config $config Config object |
||
78 | * |
||
79 | * @return array|false false on failure file meta data on success |
||
80 | */ |
||
81 | 1 | public function writeStream($path, $resource, Config $config) |
|
97 | |||
98 | /** |
||
99 | * Update a file. |
||
100 | * |
||
101 | * @param string $path |
||
102 | * @param string $contents |
||
103 | * @param Config $config Config object |
||
104 | * |
||
105 | * @return array|false false on failure file meta data on success |
||
106 | */ |
||
107 | 1 | public function update($path, $contents, Config $config) |
|
113 | |||
114 | /** |
||
115 | * Update a file using a stream. |
||
116 | * |
||
117 | * @param string $path |
||
118 | * @param resource $resource |
||
119 | * @param Config $config Config object |
||
120 | * |
||
121 | * @return array|false false on failure file meta data on success |
||
122 | */ |
||
123 | 1 | public function updateStream($path, $resource, Config $config) |
|
129 | |||
130 | /** |
||
131 | * Rename a file. |
||
132 | * |
||
133 | * @param string $path |
||
134 | * @param string $newpath |
||
135 | * |
||
136 | * @return bool |
||
137 | */ |
||
138 | 1 | public function rename($path, $newpath) |
|
144 | |||
145 | /** |
||
146 | * Copy a file. |
||
147 | * |
||
148 | * @param string $path |
||
149 | * @param string $newpath |
||
150 | * |
||
151 | * @return bool |
||
152 | */ |
||
153 | 1 | public function copy($path, $newpath) |
|
159 | |||
160 | /** |
||
161 | * Delete a file. |
||
162 | * |
||
163 | * @param string $path |
||
164 | * |
||
165 | * @return bool |
||
166 | */ |
||
167 | 1 | public function delete($path) |
|
173 | |||
174 | /** |
||
175 | * Delete a directory. |
||
176 | * |
||
177 | * @param string $dirname |
||
178 | * |
||
179 | * @return bool |
||
180 | */ |
||
181 | 1 | public function deleteDir($dirname) |
|
185 | |||
186 | /** |
||
187 | * Create a directory. |
||
188 | * |
||
189 | * @param string $dirname directory name |
||
190 | * @param Config $config |
||
191 | * |
||
192 | * @return array|false |
||
193 | */ |
||
194 | 1 | public function createDir($dirname, Config $config) |
|
198 | |||
199 | /** |
||
200 | * Check whether a file exists. |
||
201 | * |
||
202 | * @param string $path |
||
203 | * |
||
204 | * @return array|bool|null |
||
205 | */ |
||
206 | 1 | public function has($path) |
|
212 | |||
213 | /** |
||
214 | * Read a file. |
||
215 | * |
||
216 | * @param string $path |
||
217 | * |
||
218 | * @return array|false |
||
219 | */ |
||
220 | 1 | public function read($path) |
|
226 | |||
227 | /** |
||
228 | * Read a file as a stream. |
||
229 | * |
||
230 | * @param string $path |
||
231 | * |
||
232 | * @return array|false |
||
233 | */ |
||
234 | 1 | public function readStream($path) |
|
244 | |||
245 | /** |
||
246 | * List contents of a directory. |
||
247 | * |
||
248 | * @param string $directory |
||
249 | * @param bool $recursive |
||
250 | * |
||
251 | * @return array |
||
252 | */ |
||
253 | 1 | public function listContents($directory = '', $recursive = false) |
|
265 | |||
266 | /** |
||
267 | * Get all the meta data of a file or directory. |
||
268 | * |
||
269 | * @param string $path |
||
270 | * |
||
271 | * @return array|false |
||
272 | */ |
||
273 | 1 | public function getMetadata($path) |
|
280 | |||
281 | /** |
||
282 | * Get the size of a file. |
||
283 | * |
||
284 | * @param string $path |
||
285 | * |
||
286 | * @return array|false |
||
287 | */ |
||
288 | 1 | public function getSize($path) |
|
292 | |||
293 | /** |
||
294 | * Get the mimetype of a file. |
||
295 | * |
||
296 | * @param string $path |
||
297 | * |
||
298 | * @return array|false |
||
299 | */ |
||
300 | 1 | public function getMimetype($path) |
|
310 | |||
311 | /** |
||
312 | * Get the timestamp of a file. |
||
313 | * |
||
314 | * @param string $path |
||
315 | * |
||
316 | * @return array|false |
||
317 | */ |
||
318 | 1 | public function getTimestamp($path) |
|
322 | |||
323 | /** |
||
324 | * @param \Qiniu\Storage\BucketManager $manager |
||
325 | * |
||
326 | * @return $this |
||
327 | */ |
||
328 | 1 | public function setBucketManager(BucketManager $manager) |
|
334 | |||
335 | /** |
||
336 | * @param \Qiniu\Storage\UploadManager $manager |
||
337 | * |
||
338 | * @return $this |
||
339 | */ |
||
340 | 1 | public function setUploadManager(UploadManager $manager) |
|
346 | |||
347 | /** |
||
348 | * @param \Qiniu\Auth $manager |
||
349 | * |
||
350 | * @return $this |
||
351 | */ |
||
352 | 1 | public function setAuthManager(Auth $manager) |
|
358 | |||
359 | /** |
||
360 | * @return \Qiniu\Storage\BucketManager |
||
361 | */ |
||
362 | 1 | public function getBucketManager() |
|
366 | |||
367 | /** |
||
368 | * @return \Qiniu\Auth |
||
369 | */ |
||
370 | 1 | public function getAuthManager() |
|
374 | |||
375 | /** |
||
376 | * @return \Qiniu\Storage\UploadManager |
||
377 | */ |
||
378 | 1 | public function getUploadManager() |
|
382 | |||
383 | /** |
||
384 | * @param array $stats |
||
385 | * |
||
386 | * @return array |
||
387 | */ |
||
388 | 2 | protected function normalizeFileInfo(array $stats) |
|
397 | |||
398 | /** |
||
399 | * @param string $domain |
||
400 | * |
||
401 | * @return string |
||
402 | */ |
||
403 | 2 | protected function normalizeHost($domain) |
|
411 | } |
||
412 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.