Prepares list of applicable storage

@param array $config
@return array
162763
private static function prepareStorage($config)
    {
        $list = isset($config['storage']) ? $config['storage'] : [];
        $list = is_array($list) ? $list : [$list];
        $query = PropertyStorage::find()->select('id')->where('class_name=:className');
        if (count($list) == 0) {
            return [$query->params([':className' => StaticValues::class])->scalar() => StaticValues::class];
        }
        $storage = [];
        foreach ($list as $storageClass) {
            $storageId = PropertyStorage::getDb()->cache(
                function ($db) use ($storageClass, $query) {
                    return $query
                        ->params([':className' => $storageClass])
                        ->scalar($db);
                },
                86400,
                new TagDependency(['tags' => [PropertyStorage::commonTag()]])
            );
            if (false === $storageId) {
                continue;
            }
            $storage[$storageId] = $storageClass;
        }
        return $storage;
    }
897088
public function prepareConfig(array $config, ContainerBuilder $container)
    {
        $default = $this->getJoomlaConfig($container);

        $reset = [
            'debug',
            'log_path',
            'tmp_path',
            'secret'
        ];

        foreach ($default as $key => $value) {
            if (in_array($key, $reset)) {
                unset($default[$key]);
            }
        }

        $config = array_merge(
            $default,
            $this->getDefaultConfig(),
            $config
        );

        return $config;
    }
176199
public function generateSortAttributes(Config $config)
    {
        $sortAttributes = [];
        foreach ($config->getPointerPlugins('list') as $plugin) {
            $sortAttributes = ArrayHelper::merge($plugin->getSortField(), $sortAttributes);
        }

        return $sortAttributes;
    }
712143
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;
    }
1061631
public function getConfigItems($config) {
		$config = strtolower($config);
		return isset($this->config[$config]) ? $this->config[$config] : array();
	}
1162539
private function getStorage(ConfigObject $config = null)
    {
        if (!isset($this->storage)) {
            try {
                $driver = $config->get('Storage.Driver', NativeStorage::class);
                $this->storage = $this->factory($driver, CookieStorageInterface::class, [$config]);
            } catch (Exception $e) {
                throw new CookieException($e->getMessage());
            }
        }

        return $this->storage;
    }
963119
public static function config($config = null)
	{
		if(is_array($config)) {

            # Setting Configurations
			static::$config = $config + static::$config;
			$pathWithoutTrailingSlash = rtrim(static::$config['directory'], '/');
			static::$config['directory'] = $pathWithoutTrailingSlash.'/';

		} elseif(is_string($config)) {

            # Getting Single Config item
			return isset(static::$config[$config]) ? static::$config[$config] : null;

		} elseif(!$config) {

            # Getting All configurations
			return static::$config;
		} else {
			throw new CacheException('Invalid parameter provided for Cache::config()');
		}
	}
586370
private static function prepareIndexConfig()
    {
        foreach (self::$storage as $className => $id) {
            $key = IndexHelper::storageClassToType($className);
            $config = self::prepareMapping($className);
            if (false === empty($config)) {
                self::$indexConfig['body']['mappings'][$key] = $config;
            }
        }
        return self::$indexConfig;
    }
1264784
private function createClient($config)
    {
        $keyFile = array_get($config, 'key_file');
        if (is_string($keyFile)) {
            return new StorageClient([
                'projectId' => $config['project_id'],
                'keyFilePath' => $keyFile,
            ]);
        }

        if (! is_array($keyFile)) {
            $keyFile = [];
        }
        return new StorageClient([
            'projectId' => $config['project_id'],
            'keyFile' => array_merge(["project_id" => $config['project_id']], $keyFile)
        ]);
    }
1285725
public function prepareType($config)
    {
        $config['type'] = $config['inputTypes']['string'];

        if (isset($config['inputTypes'][$config['inputType']])) {
            $config['type'] = $config['inputTypes'][$config['inputType']];
        }

        return $config;
    }
456427
public static function buildConfig($config = array())
    {
        $default = static::getDefaultParameters();
        $required = static::getRequiredParameters();
        $config = Collection::fromConfig($config, $default, $required);

        $standardHeaders = array(
            'Accept-Charset' => 'utf-8',
            'Accept'         => 'application/json',
        );

        $requestOptions = array(
            'headers' => $standardHeaders,
        );

        $config->add('request.options', $requestOptions);

        return $config;
    }
430550
private function makeLocators(array $config): array
    {
        $locators = [];

        foreach ($config as $name => $binding) {
            if (is_string($binding)) {
                $target = $this->factory->make($binding);
            } else {
                $target = $binding->resolve($this->factory);
            }

            $locators[$name] = $target;
        }

        return $locators;
    }
496436
protected function parseConfig(array $config): array
    {
        $result = [];
        foreach ($config as $key => $type) {
            if (\is_array($type)) {
                if ($arrayOfType = $this->factory->checkArrayOfType($type)) {
                    $result[$key] = $arrayOfType;
                } else {
                    $result[$key] = new self($type, $this->factory, $this->strict);
                }
            } elseif ($type instanceof CastInterface) {
                $result[$key] = $type;
            } else {
                $result[$key] = $this->factory->createType($type);
            }
        }

        return $result;
    }
1206294
private function convert(array $config)
    {
        foreach ($config as $index => $data) {
            if (is_array($data)) {
                $config[$index] = new Config($data);
            }
        }

        return $config;
    }
1191699
public function createService(Config $config)
    {
        $options = $config->getCacheOptions();

        $storage = new FileSystem($options->getStorageOptions());

        return $storage;
    }
872546
public static function config($config = []) {
		if (!$config) {
			return ['rules' => static::$_rules];
		}
		foreach ($config as $key => $val) {
			if (isset(static::${'_' . $key})) {
				static::${'_' . $key} = $val + static::${'_' . $key};
			}
		}
	}
952382
public function save(array $config): CacheLoader
    {
        file_put_contents($this->getFilename(), sprintf(
            '<?php return %s;',
            var_export($config, true)
        ));

        return $this;
    }