EventListener/RateLimitListener.php
protected function createRateLimitExceededException(Request $request)
    {
        $config = $this->exceptionConfig;
        $class = $config['custom_exception'] ?? RateLimitExceededException::class;
        $username = null;

        if (null !== $token = $this->tokenStorage->getToken()) {
            if (is_object($token->getUser())) {
                $username = $token->getUsername();
            }
        }

        return new $class($config['status_code'], $config['message'], $request->getClientIp(), $username);
    }
protected function createRateLimitExceededException(Request $request)
    {
        $config = $this->exceptionConfig;
        $class = $config['custom_exception'] ?? RateLimitExceededException::class;
        $username = null;

        if (null !== $token = $this->tokenStorage->getToken()) {
            if (is_object($token->getUser())) {
                $username = $token->getUsername();
            }
        }

        return new $class($config['status_code'], $config['message'], $request->getClientIp(), $username);
    }
protected function createRateLimitExceededException ( Request $ request ) { $ config = $ this -> exceptionConfig ; $ class = $ config [ 'custom_exception' ] ?? RateLimitExceededException :: class ; $ username = null ; if ( null !== $ token = $ this -> tokenStorage -> getToken ( ) ) { if ( is_object ( $ token -> getUser ( ) ) ) { $ username = $ token -> getUsername ( ) ; } } return new $ class ( $ config [ 'status_code' ] , $ config [ 'message' ] , $ request -> getClientIp ( ) , $ username ) ; }
Returns an RateLimitExceededException.

@param Request $request

@return RateLimitExceededException
Returns an RateLimitExceededException .