private function protect(Authentication $authentication, int $httpResponseCode = 403): void
    {
        if (($this->authentication = $authentication->isLogged()) === false) {
            \http_response_code($httpResponseCode);
            throw new AuthenticationException('');
        }
    }
private function protect(Authentication $authentication, int $httpResponseCode = 403): void
    {
        if (($this->authentication = $authentication->isLogged()) === false) {
            \http_response_code($httpResponseCode);
            throw new AuthenticationException('');
        }
    }
private function protect ( Authentication $ authentication , int $ httpResponseCode = 403 ) : void { if ( ( $ this -> authentication = $ authentication -> isLogged ( ) ) === false ) { \ http_response_code ( $ httpResponseCode ) ; throw new AuthenticationException ( '' ) ; } }
Allow access to controller class or methods only if logged.
Return a status code, useful with AJAX requests.

@param Authentication $authentication
@param int            $httpResponseCode

@return void

@throws AuthenticationException if not authenticated.
Allow access to controller class or methods only if logged . Return a status code useful with AJAX requests .