original_string: 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');
          }
      }
code: 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');
          }
      }
code_tokens: 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' ) ; } }
docstring: Check if the API Rate limit has been reached.
  
  @throws UserMessageException
docstring_tokens: Check if the API Rate limit has been reached .