Bluz\Cache\Cache::initAdapter PHP Méthode

initAdapter() protected méthode

Initialize adapter
protected initAdapter ( string $adapterName ) : Bluz\Cache\CacheInterface
$adapterName string
Résultat Bluz\Cache\CacheInterface
    protected function initAdapter($adapterName)
    {
        if (!($adapterSettings = $this->getOption('settings', $adapterName))) {
            throw new ConfigurationException("Cache Adapter can't initialize. Configuration is missed");
        }
        $adapterName = ucfirst($adapterName);
        $adapterClass = '\\Bluz\\Cache\\Adapter\\' . $adapterName;
        if (!class_exists($adapterClass)) {
            throw new ComponentException("Class for cache adapter `{$adapterName}` not found");
        }
        $adapter = new $adapterClass($adapterSettings);
        return $adapter;
    }