Bluz\Cache\Cache::initAdapter PHP Method

initAdapter() protected method

Initialize adapter
protected initAdapter ( string $adapterName ) : Bluz\Cache\CacheInterface
$adapterName string
return 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;
    }