public function checkRateLimit()
    {
        $rateLimit = $this->getRateLimit();
        if ($rateLimit !== null) {
            list($maxRequests, $timeWindow) = $rateLimit;
            $visits = $this->getVisitsCountFromCurrentIP($timeWindow);
            if ($visits >= $maxRequests) {
                throw new UserMessageException(t('You reached the API rate limit (%1$s requests every %2$s seconds)', $maxRequests, $timeWindow));
            }
            $this->app->make(IPControlLog::class)->addVisit('api');
        }
    }
public function checkRateLimit()
    {
        $rateLimit = $this->getRateLimit();
        if ($rateLimit !== null) {
            list($maxRequests, $timeWindow) = $rateLimit;
            $visits = $this->getVisitsCountFromCurrentIP($timeWindow);
            if ($visits >= $maxRequests) {
                throw new UserMessageException(t('You reached the API rate limit (%1$s requests every %2$s seconds)', $maxRequests, $timeWindow));
            }
            $this->app->make(IPControlLog::class)->addVisit('api');
        }
    }
public function checkRateLimit ( ) { $ rateLimit = $ this -> getRateLimit ( ) ; if ( $ rateLimit !== null ) { list ( $ maxRequests , $ timeWindow ) = $ rateLimit ; $ visits = $ this -> getVisitsCountFromCurrentIP ( $ timeWindow ) ; if ( $ visits >= $ maxRequests ) { throw new UserMessageException ( t ( 'You reached the API rate limit (%1$s requests every %2$s seconds)' , $ maxRequests , $ timeWindow ) ) ; } $ this -> app -> make ( IPControlLog :: class ) -> addVisit ( 'api' ) ; } }
Check if the API Rate limit has been reached.

@throws UserMessageException
Check if the API Rate limit has been reached .