public function destroy($session_id = null)
    {
        if ($session_id) {
            $this->eventsManager->fireEvent('session:destroy', $this, ['session_id' => $session_id]);
            $this->do_destroy($session_id);
        } else {

            $context = $this->_context;

            if (!$context->started) {
                $this->_start();
            }

            $this->eventsManager->fireEvent('session:destroy', $this, ['session_id' => $session_id, 'context' => $context]);

            $context->started = false;
            $context->is_dirty = false;
            $context->session_id = null;
            $context->_SESSION = null;
            $this->do_destroy($context->session_id);

            $params = $this->_cookie_params;
            $this->cookies->delete($this->_name, $params['path'], $params['domain'], $params['secure'], $params['httponly']);
        }
    }
public function destroy($session_id = null)
    {
        if ($session_id) {
            $this->eventsManager->fireEvent('session:destroy', $this, ['session_id' => $session_id]);
            $this->do_destroy($session_id);
        } else {

            $context = $this->_context;

            if (!$context->started) {
                $this->_start();
            }

            $this->eventsManager->fireEvent('session:destroy', $this, ['session_id' => $session_id, 'context' => $context]);

            $context->started = false;
            $context->is_dirty = false;
            $context->session_id = null;
            $context->_SESSION = null;
            $this->do_destroy($context->session_id);

            $params = $this->_cookie_params;
            $this->cookies->delete($this->_name, $params['path'], $params['domain'], $params['secure'], $params['httponly']);
        }
    }
public function destroy ( $ session_id = null ) { if ( $ session_id ) { $ this -> eventsManager -> fireEvent ( 'session:destroy' , $ this , [ 'session_id' => $ session_id ] ) ; $ this -> do_destroy ( $ session_id ) ; } else { $ context = $ this -> _context ; if ( ! $ context -> started ) { $ this -> _start ( ) ; } $ this -> eventsManager -> fireEvent ( 'session:destroy' , $ this , [ 'session_id' => $ session_id , 'context' => $ context ] ) ; $ context -> started = false ; $ context -> is_dirty = false ; $ context -> session_id = null ; $ context -> _SESSION = null ; $ this -> do_destroy ( $ context -> session_id ) ; $ params = $ this -> _cookie_params ; $ this -> cookies -> delete ( $ this -> _name , $ params [ 'path' ] , $ params [ 'domain' ] , $ params [ 'secure' ] , $ params [ 'httponly' ] ) ; } }
Destroys the active session or assigned session

@param string $session_id

@return void
Destroys the active session or assigned session