1 | <?php |
||
15 | class Adapter extends AbstractAdapter |
||
16 | { |
||
17 | /** |
||
18 | * @var Client |
||
19 | */ |
||
20 | protected $client; |
||
21 | |||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $config = []; |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $regionMap = [ |
||
31 | 'cn-east' => 'ap-shanghai', |
||
32 | 'cn-sorth' => 'ap-guangzhou', |
||
33 | 'cn-north' => 'ap-beijing-1', |
||
34 | 'cn-south-2' => 'ap-guangzhou-2', |
||
35 | 'cn-southwest' => 'ap-chengdu', |
||
36 | 'sg' => 'ap-singapore', |
||
37 | 'tj' => 'ap-beijing-1', |
||
38 | 'bj' => 'ap-beijing', |
||
39 | 'sh' => 'ap-shanghai', |
||
40 | 'gz' => 'ap-guangzhou', |
||
41 | 'cd' => 'ap-chengdu', |
||
42 | 'sgp' => 'ap-singapore', |
||
43 | ]; |
||
44 | |||
45 | /** |
||
46 | * Adapter constructor. |
||
47 | * |
||
48 | * @param Client $client |
||
49 | * @param array $config |
||
50 | */ |
||
51 | public function __construct(Client $client, array $config) |
||
58 | |||
59 | /** |
||
60 | * @return string |
||
61 | */ |
||
62 | 18 | public function getBucket() |
|
66 | |||
67 | /** |
||
68 | * @return string |
||
69 | */ |
||
70 | 2 | public function getAppId() |
|
74 | |||
75 | /** |
||
76 | * @return string |
||
77 | */ |
||
78 | 2 | public function getRegion() |
|
82 | |||
83 | /** |
||
84 | * @param $path |
||
85 | * |
||
86 | * @return string |
||
87 | */ |
||
88 | 2 | public function getSourcePath($path) |
|
94 | |||
95 | /** |
||
96 | * @param string $path |
||
97 | * |
||
98 | * @return string |
||
99 | */ |
||
100 | 4 | public function getUrl($path) |
|
110 | |||
111 | /** |
||
112 | * @param string $path |
||
113 | * @param \DateTimeInterface $expiration |
||
114 | * @param array $options |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | public function getTemporaryUrl($path, $expiration, array $options = []) |
||
125 | |||
126 | /** |
||
127 | * @param string $path |
||
128 | * @param string $contents |
||
129 | * @param Config $config |
||
130 | * |
||
131 | * @return array|bool |
||
132 | */ |
||
133 | 2 | public function write($path, $contents, Config $config) |
|
137 | |||
138 | /** |
||
139 | * @param string $path |
||
140 | * @param resource $resource |
||
141 | * @param Config $config |
||
142 | * |
||
143 | * @return array|bool |
||
144 | */ |
||
145 | 2 | public function writeStream($path, $resource, Config $config) |
|
149 | |||
150 | /** |
||
151 | * @param string $path |
||
152 | * @param string $contents |
||
153 | * @param Config $config |
||
154 | * |
||
155 | * @return array|bool |
||
156 | */ |
||
157 | 1 | public function update($path, $contents, Config $config) |
|
161 | |||
162 | /** |
||
163 | * @param string $path |
||
164 | * @param resource $resource |
||
165 | * @param Config $config |
||
166 | * |
||
167 | * @return array|bool |
||
168 | */ |
||
169 | 1 | public function updateStream($path, $resource, Config $config) |
|
173 | |||
174 | /** |
||
175 | * @param string $path |
||
176 | * @param string $newpath |
||
177 | * |
||
178 | * @return bool |
||
179 | */ |
||
180 | 1 | public function rename($path, $newpath) |
|
194 | |||
195 | /** |
||
196 | * @param string $path |
||
197 | * @param string $newpath |
||
198 | * |
||
199 | * @return bool |
||
200 | */ |
||
201 | 1 | public function copy($path, $newpath) |
|
211 | |||
212 | /** |
||
213 | * @param string $path |
||
214 | * |
||
215 | * @return bool |
||
216 | */ |
||
217 | 1 | public function delete($path) |
|
224 | |||
225 | /** |
||
226 | * @param string $dirname |
||
227 | * |
||
228 | * @return bool |
||
229 | */ |
||
230 | 1 | public function deleteDir($dirname) |
|
243 | |||
244 | /** |
||
245 | * @param string $dirname |
||
246 | * @param Config $config |
||
247 | * |
||
248 | * @return array|bool |
||
249 | */ |
||
250 | 1 | public function createDir($dirname, Config $config) |
|
258 | |||
259 | /** |
||
260 | * @param string $path |
||
261 | * @param string $visibility |
||
262 | * |
||
263 | * @return bool |
||
264 | */ |
||
265 | 1 | public function setVisibility($path, $visibility) |
|
276 | |||
277 | /** |
||
278 | * @param string $path |
||
279 | * |
||
280 | * @return bool |
||
281 | */ |
||
282 | 1 | public function has($path) |
|
290 | |||
291 | /** |
||
292 | * @param string $path |
||
293 | * |
||
294 | * @return array|bool |
||
295 | */ |
||
296 | 1 | public function read($path) |
|
309 | |||
310 | /** |
||
311 | * @param string $path |
||
312 | * |
||
313 | * @return array|bool |
||
314 | */ |
||
315 | 1 | public function readStream($path) |
|
323 | |||
324 | /** |
||
325 | * @param string $directory |
||
326 | * @param bool $recursive |
||
327 | * |
||
328 | * @return array|bool |
||
329 | */ |
||
330 | 2 | public function listContents($directory = '', $recursive = false) |
|
338 | |||
339 | /** |
||
340 | * @param string $path |
||
341 | * |
||
342 | * @return array|bool |
||
343 | */ |
||
344 | 5 | public function getMetadata($path) |
|
351 | |||
352 | /** |
||
353 | * @param string $path |
||
354 | * |
||
355 | * @return array|bool |
||
356 | */ |
||
357 | 1 | public function getSize($path) |
|
364 | |||
365 | /** |
||
366 | * @param string $path |
||
367 | * |
||
368 | * @return array|bool |
||
369 | */ |
||
370 | 1 | public function getMimetype($path) |
|
377 | |||
378 | /** |
||
379 | * @param string $path |
||
380 | * |
||
381 | * @return array|bool |
||
382 | */ |
||
383 | 1 | public function getTimestamp($path) |
|
390 | |||
391 | /** |
||
392 | * @param string $path |
||
393 | * |
||
394 | * @return array|bool |
||
395 | */ |
||
396 | 1 | public function getVisibility($path) |
|
414 | } |
||
415 |