1 | <?php |
||
13 | class SelectelAdapter implements AdapterInterface |
||
14 | { |
||
15 | use NotSupportingVisibilityTrait; |
||
16 | |||
17 | /** |
||
18 | * Storage container. |
||
19 | * |
||
20 | * @var \ArgentCrusade\Selectel\CloudStorage\Contracts\ContainerContract |
||
21 | */ |
||
22 | protected $container; |
||
23 | |||
24 | /** |
||
25 | * Create new instance. |
||
26 | * |
||
27 | * @param \ArgentCrusade\Selectel\CloudStorage\Contracts\ContainerContract $container |
||
28 | */ |
||
29 | public function __construct(ContainerContract $container) |
||
33 | |||
34 | /** |
||
35 | * Loads file from container. |
||
36 | * |
||
37 | * @param string $path Path to file. |
||
38 | * |
||
39 | * @return \ArgentCrusade\Selectel\CloudStorage\Contracts\FileContract |
||
40 | */ |
||
41 | protected function getFile($path) |
||
45 | |||
46 | /** |
||
47 | * Transforms internal files array to Flysystem-compatible one. |
||
48 | * |
||
49 | * @param array $files Original Selectel's files array. |
||
50 | * |
||
51 | * @return array |
||
52 | */ |
||
53 | protected function transformFiles($files) |
||
69 | |||
70 | /** |
||
71 | * {@inheritdoc} |
||
72 | */ |
||
73 | public function has($path) |
||
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | public function read($path) |
||
93 | |||
94 | /** |
||
95 | * {@inheritdoc} |
||
96 | */ |
||
97 | public function readStream($path) |
||
111 | |||
112 | /** |
||
113 | * {@inheritdoc} |
||
114 | */ |
||
115 | public function listContents($directory = '', $recursive = false) |
||
122 | |||
123 | /** |
||
124 | * {@inheritdoc} |
||
125 | */ |
||
126 | public function getMetadata($path) |
||
132 | |||
133 | /** |
||
134 | * {@inheritdoc} |
||
135 | */ |
||
136 | public function getSize($path) |
||
140 | |||
141 | /** |
||
142 | * {@inheritdoc} |
||
143 | */ |
||
144 | public function getMimetype($path) |
||
148 | |||
149 | /** |
||
150 | * {@inheritdoc} |
||
151 | */ |
||
152 | public function getTimestamp($path) |
||
156 | |||
157 | /** |
||
158 | * {@inheritdoc} |
||
159 | */ |
||
160 | public function write($path, $contents, Config $config) |
||
164 | |||
165 | /** |
||
166 | * {@inheritdoc} |
||
167 | */ |
||
168 | public function writeStream($path, $resource, Config $config) |
||
172 | |||
173 | /** |
||
174 | * Writes string or stream to container. |
||
175 | * |
||
176 | * @param string $type Upload type |
||
177 | * @param string $path File path |
||
178 | * @param string|resource $payload String content or Stream resource |
||
179 | * |
||
180 | * @return array|bool |
||
181 | */ |
||
182 | protected function writeToContainer($type, $path, $payload) |
||
192 | |||
193 | /** |
||
194 | * {@inheritdoc} |
||
195 | */ |
||
196 | public function update($path, $contents, Config $config) |
||
200 | |||
201 | /** |
||
202 | * {@inheritdoc} |
||
203 | */ |
||
204 | public function updateStream($path, $resource, Config $config) |
||
208 | |||
209 | /** |
||
210 | * {@inheritdoc} |
||
211 | */ |
||
212 | public function rename($path, $newpath) |
||
222 | |||
223 | /** |
||
224 | * {@inheritdoc} |
||
225 | */ |
||
226 | public function copy($path, $newpath) |
||
236 | |||
237 | /** |
||
238 | * {@inheritdoc} |
||
239 | */ |
||
240 | public function delete($path) |
||
250 | |||
251 | /** |
||
252 | * {@inheritdoc} |
||
253 | */ |
||
254 | public function deleteDir($path) |
||
264 | |||
265 | /** |
||
266 | * {@inheritdoc} |
||
267 | */ |
||
268 | public function createDir($dirname, Config $config) |
||
278 | |||
279 | /** |
||
280 | * Get full URL to given path. |
||
281 | * |
||
282 | * @param string $path = '' |
||
283 | * |
||
284 | * @return string |
||
285 | */ |
||
286 | public function getUrl($path = '') |
||
290 | } |
||
291 |