1 | <?php |
||
12 | class CopyAdapter extends AbstractAdapter |
||
13 | { |
||
14 | use NotSupportingVisibilityTrait; |
||
15 | |||
16 | /** |
||
17 | * Result key map. |
||
18 | * |
||
19 | * @var array |
||
20 | */ |
||
21 | protected static $resultMap = [ |
||
22 | 'size' => 'size', |
||
23 | 'mime_type' => 'mimetype', |
||
24 | 'type' => 'type', |
||
25 | ]; |
||
26 | |||
27 | /** |
||
28 | * Copy API. |
||
29 | * |
||
30 | * @var API |
||
31 | */ |
||
32 | protected $client; |
||
33 | |||
34 | /** |
||
35 | * Constructor. |
||
36 | * |
||
37 | * @param API $client |
||
38 | * @param string $prefix |
||
39 | */ |
||
40 | 18 | public function __construct(API $client, $prefix = null) |
|
45 | |||
46 | /** |
||
47 | * Get the Copy API instance. |
||
48 | * |
||
49 | * @return API |
||
50 | */ |
||
51 | 3 | public function getClient() |
|
55 | |||
56 | /** |
||
57 | * Check weather a file exists. |
||
58 | * |
||
59 | * @param string $path |
||
60 | * |
||
61 | * @return array|false false or file metadata |
||
62 | */ |
||
63 | 3 | public function has($path) |
|
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | 3 | public function write($path, $contents, Config $config) |
|
78 | |||
79 | /** |
||
80 | * {@inheritdoc} |
||
81 | */ |
||
82 | 3 | public function writeStream($path, $resource, Config $config) |
|
89 | |||
90 | /** |
||
91 | * {@inheritdoc} |
||
92 | */ |
||
93 | 3 | public function update($path, $contents, Config $config) |
|
100 | |||
101 | /** |
||
102 | * {@inheritdoc} |
||
103 | */ |
||
104 | 3 | public function updateStream($path, $resource, Config $config) |
|
111 | |||
112 | /** |
||
113 | * {@inheritdoc} |
||
114 | */ |
||
115 | 3 | public function read($path) |
|
121 | |||
122 | /** |
||
123 | * {@inheritdoc} |
||
124 | */ |
||
125 | 3 | public function readStream($path) |
|
131 | |||
132 | /** |
||
133 | * {@inheritdoc} |
||
134 | */ |
||
135 | 3 | public function rename($path, $newpath) |
|
146 | |||
147 | /** |
||
148 | * {@inheritdoc} |
||
149 | */ |
||
150 | 6 | public function copy($path, $newpath) |
|
163 | |||
164 | /** |
||
165 | * {@inheritdoc} |
||
166 | */ |
||
167 | 3 | public function delete($path) |
|
173 | |||
174 | /** |
||
175 | * {@inheritdoc} |
||
176 | */ |
||
177 | 3 | public function deleteDir($path) |
|
183 | |||
184 | /** |
||
185 | * {@inheritdoc} |
||
186 | */ |
||
187 | 6 | public function createDir($path, Config $config) |
|
199 | |||
200 | /** |
||
201 | * {@inheritdoc} |
||
202 | */ |
||
203 | 15 | public function getMetadata($path) |
|
214 | |||
215 | /** |
||
216 | * {@inheritdoc} |
||
217 | */ |
||
218 | 3 | public function getMimetype($path) |
|
222 | |||
223 | /** |
||
224 | * {@inheritdoc} |
||
225 | */ |
||
226 | 3 | public function getSize($path) |
|
230 | |||
231 | /** |
||
232 | * {@inheritdoc} |
||
233 | */ |
||
234 | 3 | public function getTimestamp($path) |
|
238 | |||
239 | /** |
||
240 | * {@inheritdoc} |
||
241 | */ |
||
242 | 3 | public function listContents($dirname = '', $recursive = false) |
|
261 | |||
262 | /** |
||
263 | * Normalize a result from Copy. |
||
264 | * |
||
265 | * @param stdClass $object |
||
266 | * @param string $path |
||
267 | * |
||
268 | * @return array|false file metadata |
||
269 | */ |
||
270 | 30 | protected function normalizeObject($object, $path) |
|
285 | |||
286 | /** |
||
287 | * Apply the path prefix. |
||
288 | * |
||
289 | * @param string $path |
||
290 | * |
||
291 | * @return string prefixed path |
||
292 | */ |
||
293 | 54 | public function applyPathPrefix($path) |
|
299 | } |
||
300 |