src/Service.php
public function getPrincipal(): Principal
    {
        if ($this->principal === null && !$this->resume()) {
            $this->principal = Principal::getAnonymous();
        }
        return $this->principal;
    }
public function getPrincipal(): Principal
    {
        if ($this->principal === null && !$this->resume()) {
            $this->principal = Principal::getAnonymous();
        }
        return $this->principal;
    }
public function getPrincipal ( ) : Principal { if ( $ this -> principal === null && ! $ this -> resume ( ) ) { $ this -> principal = Principal :: getAnonymous ( ) ; } return $ this -> principal ; }
Gets the currently authenticated principal.

If no one is authenticated, this will return an anonymous Principal. If
The session is not started but can be resumed, it will be resumed and the
principal will be loaded.

@return Principal the authenticated principal
Gets the currently authenticated principal .