1 | <?php |
||
19 | class Flysystem implements IOMetadataHandler |
||
20 | { |
||
21 | /** @var FilesystemInterface */ |
||
22 | private $filesystem; |
||
23 | |||
24 | public function __construct(FilesystemInterface $filesystem) |
||
28 | |||
29 | /** |
||
30 | * Only reads & return metadata, since the binarydata handler took care of creating the file already. |
||
31 | * |
||
32 | * @throws BinaryFileNotFoundException |
||
33 | */ |
||
34 | public function create(SPIBinaryFileCreateStruct $spiBinaryFileCreateStruct) |
||
38 | |||
39 | /** |
||
40 | * Does really nothing, the binary data handler takes care of it. |
||
41 | * |
||
42 | * @param $spiBinaryFileId |
||
43 | */ |
||
44 | public function delete($spiBinaryFileId) |
||
47 | |||
48 | public function load($spiBinaryFileId) |
||
66 | |||
67 | public function loadAll($scope) |
||
68 | { |
||
69 | //TODO return SPIBinaryFiles |
||
70 | return $this->filesystem->listContents($this->getFilePrefixForScope($scope), true); |
||
71 | } |
||
72 | |||
73 | public function exists($spiBinaryFileId) |
||
74 | { |
||
75 | return $this->filesystem->has($spiBinaryFileId); |
||
76 | } |
||
77 | |||
78 | public function getMimeType($spiBinaryFileId) |
||
79 | { |
||
80 | return $this->filesystem->getMimetype($spiBinaryFileId); |
||
|
|||
81 | } |
||
82 | |||
83 | /** |
||
84 | * Does nothing, as the binarydata handler takes care of it. |
||
85 | */ |
||
86 | public function deleteDirectory($spiPath) |
||
87 | { |
||
88 | } |
||
89 | |||
90 | public function count($scope) |
||
94 | |||
95 | /** |
||
96 | * Get the file prefix (storage path) for the given $scope. |
||
97 | * |
||
98 | * @param $scope |
||
99 | * @return string |
||
100 | */ |
||
101 | private function getFilePrefixForScope($scope) |
||
116 | } |
||
117 |