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) |
||
73 | |||
74 | /** |
||
75 | * {@inheritdoc} |
||
76 | */ |
||
77 | public function has($path) |
||
81 | |||
82 | /** |
||
83 | * {@inheritdoc} |
||
84 | */ |
||
85 | public function read($path) |
||
97 | |||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | */ |
||
101 | public function readStream($path) |
||
115 | |||
116 | /** |
||
117 | * {@inheritdoc} |
||
118 | */ |
||
119 | public function listContents($directory = '', $recursive = false) |
||
126 | |||
127 | /** |
||
128 | * {@inheritdoc} |
||
129 | */ |
||
130 | public function getMetadata($path) |
||
136 | |||
137 | /** |
||
138 | * {@inheritdoc} |
||
139 | */ |
||
140 | public function getSize($path) |
||
144 | |||
145 | /** |
||
146 | * {@inheritdoc} |
||
147 | */ |
||
148 | public function getMimetype($path) |
||
152 | |||
153 | /** |
||
154 | * {@inheritdoc} |
||
155 | */ |
||
156 | public function getTimestamp($path) |
||
160 | |||
161 | /** |
||
162 | * {@inheritdoc} |
||
163 | */ |
||
164 | public function getVisibility($path) |
||
168 | |||
169 | /** |
||
170 | * {@inheritdoc} |
||
171 | */ |
||
172 | public function write($path, $contents, Config $config) |
||
176 | |||
177 | /** |
||
178 | * {@inheritdoc} |
||
179 | */ |
||
180 | public function writeStream($path, $resource, Config $config) |
||
184 | |||
185 | /** |
||
186 | * Writes string or stream to container. |
||
187 | * |
||
188 | * @param string $type Upload type |
||
189 | * @param string $path File path |
||
190 | * @param string|resource $payload String content or Stream resource |
||
191 | * |
||
192 | * @return array|bool |
||
193 | */ |
||
194 | protected function writeToContainer($type, $path, $payload) |
||
204 | |||
205 | /** |
||
206 | * {@inheritdoc} |
||
207 | */ |
||
208 | public function update($path, $contents, Config $config) |
||
212 | |||
213 | /** |
||
214 | * {@inheritdoc} |
||
215 | */ |
||
216 | public function updateStream($path, $resource, Config $config) |
||
220 | |||
221 | /** |
||
222 | * {@inheritdoc} |
||
223 | */ |
||
224 | public function rename($path, $newpath) |
||
234 | |||
235 | /** |
||
236 | * {@inheritdoc} |
||
237 | */ |
||
238 | public function copy($path, $newpath) |
||
248 | |||
249 | /** |
||
250 | * {@inheritdoc} |
||
251 | */ |
||
252 | public function delete($path) |
||
262 | |||
263 | /** |
||
264 | * {@inheritdoc} |
||
265 | */ |
||
266 | public function deleteDir($path) |
||
276 | |||
277 | /** |
||
278 | * {@inheritdoc} |
||
279 | */ |
||
280 | public function createDir($dirname, Config $config) |
||
290 | |||
291 | /** |
||
292 | * {@inheritdoc} |
||
293 | */ |
||
294 | public function setVisibility($path, $visibility) |
||
303 | } |
||
304 |