HBLL-Collection-Development /
omeka-s-any-cloud
| 1 | <?php |
||
| 2 | |||
| 3 | namespace AnyCloud\Service\File\Store; |
||
| 4 | |||
| 5 | use Google\Cloud\Storage\StorageClient; |
||
| 6 | use League\Flysystem\FilesystemAdapter; |
||
| 7 | use League\Flysystem\GoogleCloudStorage\GoogleCloudStorageAdapter; |
||
| 8 | |||
| 9 | class GoogleFactory extends AbstractFlysystemFactory |
||
| 10 | { |
||
| 11 | protected function getConfigKey(): string |
||
| 12 | { |
||
| 13 | return 'google'; |
||
| 14 | } |
||
| 15 | |||
| 16 | protected function getFilesystemAdapter(array $config): FilesystemAdapter |
||
| 17 | { |
||
| 18 | $client = new StorageClient([ |
||
| 19 | 'projectId' => $config['project_id'], |
||
| 20 | 'keyFilePath' => sprintf('%s/modules/AnyCloud%s', OMEKA_PATH, $config['credentials_path']), |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 21 | ]); |
||
| 22 | $bucket = $client->bucket($config['bucket_name']); |
||
| 23 | $adapter = new GoogleCloudStorageAdapter($bucket); |
||
| 24 | |||
| 25 | return $adapter; |
||
| 26 | } |
||
| 27 | } |
||
| 28 |