Esempio n. 1
0
 /**
  * Destroy the session (including all namespaces and cookie).
  * If session has not been previously started, it will be done
  * automatically. It won't modify current lock, be careful.
  *
  * @return  void
  * @throws  \Hoa\Session\Exception
  */
 public static function destroy()
 {
     static::start();
     if (true == ini_get('session.use_cookies')) {
         if (headers_sent($filename, $line)) {
             throw new Exception('Headers have been already sent, cannot destroy cookie; ' . 'output started in %s at line %d.', 14, [$filename, $line]);
         }
         $parameters = session_get_cookie_params();
         setcookie(session_name(), '', time() - 1, $parameters['path'], $parameters['domain'], $parameters['secure'], $parameters['httponly']);
     }
     session_destroy();
     static::$_started = false;
     // let locks unchanged.
     return;
 }
Esempio n. 2
0
 /**
  * Indicates that the session has started
  * @param bool $started
  * @return bool
  */
 public function isStarted($started = null)
 {
     return static::$_started = is_bool($started) ? $started : static::$_started;
 }