protected function setDebugHandler($options, $fp = null)
    {
        try {
            if (is_bool($fp)) {
                $fp = null;
            }

            $handler = $this->getConfig('handler');
            // if we have a default handler, and we've already created a DebugHandler
            // we can bail out now (or we will add another one to the stack)
            if ($handler && $this->debugHandler) {
                return $options;
            }

            if (isset($options['handler'])) {
                $handler = $options['handler'];
            }

            if ($handler === null) {
                $handler = \GuzzleHttp\HandlerStack::create();
            }

            if (!$this->debugHandler) {
                $this->debugHandler = new DebugHandler($fp);
            }

            $handler->after('allow_redirects', $this->debugHandler, 'debug');
        } catch (\InvalidArgumentException $e) {
            $handler->push($this->debugHandler, 'debug');
        }

        $options['handler'] = $handler;

        return $options;
    }
protected function setDebugHandler($options, $fp = null)
    {
        try {
            if (is_bool($fp)) {
                $fp = null;
            }

            $handler = $this->getConfig('handler');
            // if we have a default handler, and we've already created a DebugHandler
            // we can bail out now (or we will add another one to the stack)
            if ($handler && $this->debugHandler) {
                return $options;
            }

            if (isset($options['handler'])) {
                $handler = $options['handler'];
            }

            if ($handler === null) {
                $handler = \GuzzleHttp\HandlerStack::create();
            }

            if (!$this->debugHandler) {
                $this->debugHandler = new DebugHandler($fp);
            }

            $handler->after('allow_redirects', $this->debugHandler, 'debug');
        } catch (\InvalidArgumentException $e) {
            $handler->push($this->debugHandler, 'debug');
        }

        $options['handler'] = $handler;

        return $options;
    }
protected function setDebugHandler ( $ options , $ fp = null ) { try { if ( is_bool ( $ fp ) ) { $ fp = null ; } $ handler = $ this -> getConfig ( 'handler' ) ; // if we have a default handler, and we've already created a DebugHandler // we can bail out now (or we will add another one to the stack) if ( $ handler && $ this -> debugHandler ) { return $ options ; } if ( isset ( $ options [ 'handler' ] ) ) { $ handler = $ options [ 'handler' ] ; } if ( $ handler === null ) { $ handler = \ GuzzleHttp \ HandlerStack :: create ( ) ; } if ( ! $ this -> debugHandler ) { $ this -> debugHandler = new DebugHandler ( $ fp ) ; } $ handler -> after ( 'allow_redirects' , $ this -> debugHandler , 'debug' ) ; } catch ( \ InvalidArgumentException $ e ) { $ handler -> push ( $ this -> debugHandler , 'debug' ) ; } $ options [ 'handler' ] = $ handler ; return $ options ; }
Add the Debug handler to the HandlerStack

@param array $options Guzzle Options
@param bool|resource|null $fp Stream to write to
@return array
Add the Debug handler to the HandlerStack