public function storage(StorageInterface $storage = null)
{
if ($storage !== null) {
$this->_storage = $storage;
return null;
}
if ($this->_storage) {
return $this->_storage;
}
$config = $this->_config['storage'];
if (is_string($config)) {
$class = $config;
$config = [];
} else {
$class = $config['className'];
unset($config['className']);
}
$className = App::className($class, 'Auth/Storage', 'Storage');
if (!class_exists($className)) {
throw new Exception(sprintf('Auth storage adapter "%s" was not found.', $class));
}
$this->_storage = new $className($this->request, $this->response, $config);
return $this->_storage;
}