original_string: protected function getRateLimit(array $headers)
      {
          $rateLimit = array(
              'limit' => '?',
              'reset' => '?',
          );
  
          foreach ($headers as $header) {
              $header = trim($header);
              if (false === strpos($header, 'X-RateLimit-')) {
                  continue;
              }
              list($type, $value) = explode(':', $header, 2);
              switch ($type) {
                  case 'X-RateLimit-Limit':
                      $rateLimit['limit'] = (int) trim($value);
                      break;
                  case 'X-RateLimit-Reset':
                      $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
                      break;
              }
          }
  
          return $rateLimit;
      }
code: protected function getRateLimit(array $headers)
      {
          $rateLimit = array(
              'limit' => '?',
              'reset' => '?',
          );
  
          foreach ($headers as $header) {
              $header = trim($header);
              if (false === strpos($header, 'X-RateLimit-')) {
                  continue;
              }
              list($type, $value) = explode(':', $header, 2);
              switch ($type) {
                  case 'X-RateLimit-Limit':
                      $rateLimit['limit'] = (int) trim($value);
                      break;
                  case 'X-RateLimit-Reset':
                      $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
                      break;
              }
          }
  
          return $rateLimit;
      }
code_tokens: protected function getRateLimit ( array $ headers ) { $ rateLimit = array ( 'limit' => '?' , 'reset' => '?' , ) ; foreach ( $ headers as $ header ) { $ header = trim ( $ header ) ; if ( false === strpos ( $ header , 'X-RateLimit-' ) ) { continue ; } list ( $ type , $ value ) = explode ( ':' , $ header , 2 ) ; switch ( $ type ) { case 'X-RateLimit-Limit' : $ rateLimit [ 'limit' ] = ( int ) trim ( $ value ) ; break ; case 'X-RateLimit-Reset' : $ rateLimit [ 'reset' ] = date ( 'Y-m-d H:i:s' , ( int ) trim ( $ value ) ) ; break ; } } return $ rateLimit ; }
docstring: Extract ratelimit from response.
  
  @param array $headers Headers from Composer\Downloader\TransportException.
  
  @return array Associative array with the keys limit and reset.
docstring_tokens: Extract ratelimit from response .