Esempio n. 1
0
 /**
  * Destroys the session
  * @return \Nimbles\Http\Session
  */
 public function destroy()
 {
     if (!$this->isStarted()) {
         return;
     }
     $this->clear();
     if (ini_get('session.use_cookies')) {
         $params = $this->getCookieParams();
         $cookie = new Cookie(array('name' => $this->getName(), 'value' => '', 'expire' => time() - 42000, 'path' => $params['path'], 'domain' => $params['domain'], 'secure' => $params['secure'], 'httponly' => $params['httponly']));
         $cookie->setDelegate('headers_sent', $this->getDelegate('headers_sent'));
         $cookie->setDelegate('setcookie', $this->getDelegate('setcookie'));
         $cookie->setDelegate('setrawcookie', $this->getDelegate('setrawcookie'));
         $cookie->send();
     }
     $this->session_destroy();
     return $this;
 }