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) |
||
68 | |||
69 | /** |
||
70 | * {@inheritdoc} |
||
71 | */ |
||
72 | public function has($path) |
||
76 | |||
77 | /** |
||
78 | * {@inheritdoc} |
||
79 | */ |
||
80 | public function read($path) |
||
92 | |||
93 | /** |
||
94 | * {@inheritdoc} |
||
95 | */ |
||
96 | public function readStream($path) |
||
110 | |||
111 | /** |
||
112 | * {@inheritdoc} |
||
113 | */ |
||
114 | public function listContents($directory = '', $recursive = false) |
||
121 | |||
122 | /** |
||
123 | * {@inheritdoc} |
||
124 | */ |
||
125 | public function getMetadata($path) |
||
131 | |||
132 | /** |
||
133 | * {@inheritdoc} |
||
134 | */ |
||
135 | public function getSize($path) |
||
139 | |||
140 | /** |
||
141 | * {@inheritdoc} |
||
142 | */ |
||
143 | public function getMimetype($path) |
||
147 | |||
148 | /** |
||
149 | * {@inheritdoc} |
||
150 | */ |
||
151 | public function getTimestamp($path) |
||
155 | |||
156 | /** |
||
157 | * {@inheritdoc} |
||
158 | */ |
||
159 | public function write($path, $contents, Config $config) |
||
163 | |||
164 | /** |
||
165 | * {@inheritdoc} |
||
166 | */ |
||
167 | public function writeStream($path, $resource, Config $config) |
||
171 | |||
172 | /** |
||
173 | * Writes string or stream to container. |
||
174 | * |
||
175 | * @param string $type Upload type |
||
176 | * @param string $path File path |
||
177 | * @param string|resource $payload String content or Stream resource |
||
178 | * |
||
179 | * @return array|bool |
||
180 | */ |
||
181 | protected function writeToContainer($type, $path, $payload) |
||
191 | |||
192 | /** |
||
193 | * {@inheritdoc} |
||
194 | */ |
||
195 | public function update($path, $contents, Config $config) |
||
199 | |||
200 | /** |
||
201 | * {@inheritdoc} |
||
202 | */ |
||
203 | public function updateStream($path, $resource, Config $config) |
||
207 | |||
208 | /** |
||
209 | * {@inheritdoc} |
||
210 | */ |
||
211 | public function rename($path, $newpath) |
||
221 | |||
222 | /** |
||
223 | * {@inheritdoc} |
||
224 | */ |
||
225 | public function copy($path, $newpath) |
||
235 | |||
236 | /** |
||
237 | * {@inheritdoc} |
||
238 | */ |
||
239 | public function delete($path) |
||
249 | |||
250 | /** |
||
251 | * {@inheritdoc} |
||
252 | */ |
||
253 | public function deleteDir($path) |
||
263 | |||
264 | /** |
||
265 | * {@inheritdoc} |
||
266 | */ |
||
267 | public function createDir($dirname, Config $config) |
||
277 | } |
||
278 |