code: public function isRateLimited(array $headers)
      {
          foreach ($headers as $header) {
              if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
                  return true;
              }
          }
  
          return false;
      }
docs: Finds whether a request failed due to rate limiting
  
  @param array $headers Headers from Composer\Downloader\TransportException.
  
  @return bool