protected function initAdapter()
{
if (is_null($this->adapter) || $this->adapter === 'files') {
// try to apply settings
if ($settings = $this->getOption('settings', 'files')) {
$this->setSavePath($settings['save_path']);
}
return true;
} elseif (is_string($this->adapter)) {
$adapterClass = '\\Bluz\\Session\\Adapter\\' . ucfirst($this->adapter);
if (!class_exists($adapterClass) || !is_subclass_of($adapterClass, '\\SessionHandlerInterface')) {
throw new ComponentException("Class for session adapter `{$this->adapter}` not found");
}
$settings = $this->getOption('settings', $this->adapter) ?: [];
$this->adapter = new $adapterClass($settings);
}
return session_set_save_handler($this->adapter);
}