1 | <?php |
||
12 | class SelectelAdapter implements AdapterInterface |
||
13 | { |
||
14 | /** |
||
15 | * Storage container. |
||
16 | * |
||
17 | * @var \ArgentCrusade\Selectel\CloudStorage\Contracts\ContainerContract |
||
18 | */ |
||
19 | protected $container; |
||
20 | |||
21 | /** |
||
22 | * Container visibility. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $visibility = 'public'; |
||
27 | |||
28 | /** |
||
29 | * Create new instance. |
||
30 | * |
||
31 | * @param \ArgentCrusade\Selectel\CloudStorage\Contracts\ContainerContract $container |
||
32 | */ |
||
33 | public function __construct(ContainerContract $container) |
||
38 | |||
39 | /** |
||
40 | * Loads file from container. |
||
41 | * |
||
42 | * @param string $path Path to file. |
||
43 | * |
||
44 | * @return \ArgentCrusade\Selectel\CloudStorage\Contracts\FileContract |
||
45 | */ |
||
46 | protected function getFile($path) |
||
50 | |||
51 | /** |
||
52 | * Transforms internal files array to Flysystem-compatible one. |
||
53 | * |
||
54 | * @param array $files Original Selectel's files array. |
||
55 | * |
||
56 | * @return array |
||
57 | */ |
||
58 | protected function transformFiles($files) |
||
74 | |||
75 | /** |
||
76 | * {@inheritdoc} |
||
77 | */ |
||
78 | public function has($path) |
||
82 | |||
83 | /** |
||
84 | * {@inheritdoc} |
||
85 | */ |
||
86 | public function read($path) |
||
98 | |||
99 | /** |
||
100 | * {@inheritdoc} |
||
101 | */ |
||
102 | public function readStream($path) |
||
116 | |||
117 | /** |
||
118 | * {@inheritdoc} |
||
119 | */ |
||
120 | public function listContents($directory = '', $recursive = false) |
||
127 | |||
128 | /** |
||
129 | * {@inheritdoc} |
||
130 | */ |
||
131 | public function getMetadata($path) |
||
137 | |||
138 | /** |
||
139 | * {@inheritdoc} |
||
140 | */ |
||
141 | public function getSize($path) |
||
145 | |||
146 | /** |
||
147 | * {@inheritdoc} |
||
148 | */ |
||
149 | public function getMimetype($path) |
||
153 | |||
154 | /** |
||
155 | * {@inheritdoc} |
||
156 | */ |
||
157 | public function getTimestamp($path) |
||
161 | |||
162 | /** |
||
163 | * {@inheritdoc} |
||
164 | */ |
||
165 | public function getVisibility($path) |
||
169 | |||
170 | /** |
||
171 | * {@inheritdoc} |
||
172 | */ |
||
173 | public function write($path, $contents, Config $config) |
||
177 | |||
178 | /** |
||
179 | * {@inheritdoc} |
||
180 | */ |
||
181 | public function writeStream($path, $resource, Config $config) |
||
185 | |||
186 | /** |
||
187 | * Writes string or stream to container. |
||
188 | * |
||
189 | * @param string $type Upload type |
||
190 | * @param string $path File path |
||
191 | * @param string|resource $payload String content or Stream resource |
||
192 | * |
||
193 | * @return array|bool |
||
194 | */ |
||
195 | protected function writeToContainer($type, $path, $payload) |
||
205 | |||
206 | /** |
||
207 | * {@inheritdoc} |
||
208 | */ |
||
209 | public function update($path, $contents, Config $config) |
||
213 | |||
214 | /** |
||
215 | * {@inheritdoc} |
||
216 | */ |
||
217 | public function updateStream($path, $resource, Config $config) |
||
221 | |||
222 | /** |
||
223 | * {@inheritdoc} |
||
224 | */ |
||
225 | public function rename($path, $newpath) |
||
235 | |||
236 | /** |
||
237 | * {@inheritdoc} |
||
238 | */ |
||
239 | public function copy($path, $newpath) |
||
249 | |||
250 | /** |
||
251 | * {@inheritdoc} |
||
252 | */ |
||
253 | public function delete($path) |
||
263 | |||
264 | /** |
||
265 | * {@inheritdoc} |
||
266 | */ |
||
267 | public function deleteDir($path) |
||
277 | |||
278 | /** |
||
279 | * {@inheritdoc} |
||
280 | */ |
||
281 | public function createDir($dirname, Config $config) |
||
291 | |||
292 | /** |
||
293 | * {@inheritdoc} |
||
294 | */ |
||
295 | public function setVisibility($path, $visibility) |
||
304 | } |
||
305 |