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;
    }
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;
    }
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 ; }
Extract ratelimit from response.

@param array $headers Headers from Composer\Downloader\TransportException.

@return array Associative array with the keys limit and reset.
Extract ratelimit from response .