public function logout(): bool
    {
        if ($this->values->offsetExists('principal')) {
            $principal = $this->getPrincipal();
            $this->principal = Principal::getAnonymous();

            $this->session->destroy();

            $this->logger->info(
                "Authentication logout: {user}",
                ['user' => $principal]
            );
            return $this->publishLogout($principal);
        }
        return false;
    }
public function logout(): bool
    {
        if ($this->values->offsetExists('principal')) {
            $principal = $this->getPrincipal();
            $this->principal = Principal::getAnonymous();

            $this->session->destroy();

            $this->logger->info(
                "Authentication logout: {user}",
                ['user' => $principal]
            );
            return $this->publishLogout($principal);
        }
        return false;
    }
public function logout ( ) : bool { if ( $ this -> values -> offsetExists ( 'principal' ) ) { $ principal = $ this -> getPrincipal ( ) ; $ this -> principal = Principal :: getAnonymous ( ) ; $ this -> session -> destroy ( ) ; $ this -> logger -> info ( "Authentication logout: {user}" , [ 'user' => $ principal ] ) ; return $ this -> publishLogout ( $ principal ) ; } return false ; }
Logs out the currently authenticated principal.

@return bool If a principal existed in the session to log out
Logs out the currently authenticated principal .