/** * Configuring session handler. * * @param \SessionHandler $handler */ protected function initHandler(\SessionHandler $handler = null) { if (!empty($handler)) { session_set_save_handler($handler, true); return; } if ($this->config->sessionHandler() == SessionConfig::NATIVE_HANDLER) { //Nothing to do return; } $benchmark = $this->benchmark('handler', $this->config->sessionHandler()); $handler = $this->factory->make($this->config->handlerClass(), $this->config->handlerParameters()); $this->benchmark($benchmark); session_set_save_handler($handler, true); }
/** * Generate session cookie. * * @param UriInterface $uri Incoming uri. * @param string $sessionID * @return Cookie */ private function sessionCookie(UriInterface $uri, $sessionID) { return Cookie::create($this->config->sessionCookie(), $sessionID, $this->config->sessionLifetime(), $this->httpConfig->basePath(), $this->httpConfig->cookiesDomain($uri)); }