use Google\Cloud\Storage\StorageClient;
use League\Flysystem\FilesystemAdapter;
use League\Flysystem\GoogleCloudStorage\GoogleCloudStorageAdapter;
use Shopware\Core\Framework\Log\Package;
use Symfony\Component\OptionsResolver\OptionsResolver;
#[Package('core')]
class GoogleStorageFactory implements AdapterFactoryInterface
{ public function create(array
$config): FilesystemAdapter
{ $options =
$this->
resolveStorageConfig($config);
$storageConfig =
['projectId' =>
$options['projectId'
]];
if (isset($config['keyFile'
])) { $storageConfig['keyFile'
] =
$options['keyFile'
];
} else { $storageConfig['keyFilePath'
] =
$options['keyFilePath'
];
} $bucket =
(new StorageClient($storageConfig))->
bucket($options['bucket'
]);
return new GoogleCloudStorageAdapter($bucket,
$options['root'
]);
}