private function configureStorage(array $config)
{
if (!isset($config['storage']) || !isset($config['storage']['adapter'])) {
throw new InvalidArgumentException('Missing storage adapter configuration for the image variations event listener', 500);
}
$config = $config['storage'];
if (is_callable($config['adapter'])) {
$storageAdapter = $config['adapter']();
} else {
if (is_string($config['adapter'])) {
$storageAdapter = new $config['adapter'](isset($config['params']) ? $config['params'] : null);
} else {
$storageAdapter = $config['adapter'];
}
}
if (!$storageAdapter instanceof StorageInterface) {
throw new InvalidArgumentException('Invalid storage adapter for the image variations event listener', 500);
}
$this->storage = $storageAdapter;
}