src/Guzzle/Http/RedirectPlugin.php
protected function throwTooManyRedirectsException(RequestInterface $original, $max)
    {
        $original->getEventDispatcher()->addListener(
            'request.complete',
            $func = function ($e) use (&$func, $original, $max) {
                $original->getEventDispatcher()->removeListener('request.complete', $func);
                $str = "{$max} redirects were issued for this request:\n" . $e['request']->getRawHeaders();
                throw new TooManyRedirectsException($str);
            }
        );
    }
protected function throwTooManyRedirectsException(RequestInterface $original, $max)
    {
        $original->getEventDispatcher()->addListener(
            'request.complete',
            $func = function ($e) use (&$func, $original, $max) {
                $original->getEventDispatcher()->removeListener('request.complete', $func);
                $str = "{$max} redirects were issued for this request:\n" . $e['request']->getRawHeaders();
                throw new TooManyRedirectsException($str);
            }
        );
    }
protected function throwTooManyRedirectsException ( RequestInterface $ original , $ max ) { $ original -> getEventDispatcher ( ) -> addListener ( 'request.complete' , $ func = function ( $ e ) use ( & $ func , $ original , $ max ) { $ original -> getEventDispatcher ( ) -> removeListener ( 'request.complete' , $ func ) ; $ str = "{$max} redirects were issued for this request:\n" . $ e [ 'request' ] -> getRawHeaders ( ) ; throw new TooManyRedirectsException ( $ str ) ; } ) ; }
Throw a too many redirects exception for a request

@param RequestInterface $original Request
@param int              $max      Max allowed redirects

@throws TooManyRedirectsException when too many redirects have been issued
Throw a too many redirects exception for a request