1 | <?php |
||
8 | trait FilesTransformer |
||
9 | { |
||
10 | /** |
||
11 | * Container name. This name will be used in transformation process. |
||
12 | * |
||
13 | * @return string |
||
14 | */ |
||
15 | abstract public function containerName(); |
||
16 | |||
17 | /** |
||
18 | * API Client. |
||
19 | * |
||
20 | * @return \ArgentCrusade\Selectel\CloudStorage\Contracts\Api\ApiClientContract |
||
21 | */ |
||
22 | abstract public function apiClient(); |
||
23 | |||
24 | /** |
||
25 | * Transforms file array to instance of File object. |
||
26 | * |
||
27 | * @param array $file File array. |
||
28 | * |
||
29 | * @return \ArgentCrusade\Selectel\CloudStorage\Contracts\FileContract |
||
30 | */ |
||
31 | public function getFileFromArray(array $file) |
||
35 | |||
36 | /** |
||
37 | * Transforms Collection of file arrays (or plain array) to Collection of File objects. |
||
38 | * Warning: converting a lot of files to `File` instances may result in performance loss. |
||
39 | * |
||
40 | * @param array|\ArgentCrusade\Selectel\CloudStorage\Collections\Collection $files |
||
41 | * |
||
42 | * @return \ArgentCrusade\Selectel\CloudStorage\Collections\Collection |
||
43 | */ |
||
44 | public function getFilesCollectionFromArrays($files) |
||
54 | } |
||
55 |