src/RestClient.php
private function createDefaultClient(array $params)
    {
        $stack = HandlerStack::create();

        if (isset($params['cache']) && $params['cache'] === true) {
            $cache = new CacheMiddleware($this->getCacheStrategy());

            $stack->push($cache, 'snorlax-cache');
        }

        if (isset($params['log']) && $params['log'] === true) {
            $logger = new Logger($this->getLogger());
            $logger->setLogLevel(LogLevel::DEBUG);
            $logger->setRequestLoggingEnabled();
            $logger->setFormatter(new MessageFormatter(
                'REQ "{method} {target} HTTP/{version}"',
                'RES "{method} {target} HTTP/{version}" {code}'
            ));

            $stack->push($logger, 'snorlax-logger');
        }

        $params = array_merge($params, ['handler' => $stack]);

        return new Client($params);
    }
private function createDefaultClient(array $params)
    {
        $stack = HandlerStack::create();

        if (isset($params['cache']) && $params['cache'] === true) {
            $cache = new CacheMiddleware($this->getCacheStrategy());

            $stack->push($cache, 'snorlax-cache');
        }

        if (isset($params['log']) && $params['log'] === true) {
            $logger = new Logger($this->getLogger());
            $logger->setLogLevel(LogLevel::DEBUG);
            $logger->setRequestLoggingEnabled();
            $logger->setFormatter(new MessageFormatter(
                'REQ "{method} {target} HTTP/{version}"',
                'RES "{method} {target} HTTP/{version}" {code}'
            ));

            $stack->push($logger, 'snorlax-logger');
        }

        $params = array_merge($params, ['handler' => $stack]);

        return new Client($params);
    }
private function createDefaultClient ( array $ params ) { $ stack = HandlerStack :: create ( ) ; if ( isset ( $ params [ 'cache' ] ) && $ params [ 'cache' ] === true ) { $ cache = new CacheMiddleware ( $ this -> getCacheStrategy ( ) ) ; $ stack -> push ( $ cache , 'snorlax-cache' ) ; } if ( isset ( $ params [ 'log' ] ) && $ params [ 'log' ] === true ) { $ logger = new Logger ( $ this -> getLogger ( ) ) ; $ logger -> setLogLevel ( LogLevel :: DEBUG ) ; $ logger -> setRequestLoggingEnabled ( ) ; $ logger -> setFormatter ( new MessageFormatter ( 'REQ "{method} {target} HTTP/{version}"' , 'RES "{method} {target} HTTP/{version}" {code}' ) ) ; $ stack -> push ( $ logger , 'snorlax-logger' ) ; } $ params = array_merge ( $ params , [ 'handler' => $ stack ] ) ; return new Client ( $ params ) ; }
Creates a new default client based on the given parameters

@param array $params

@return \GuzzleHttp\Client
Creates a new default client based on the given parameters