public function createHttpClient($name = '', $client = null)
    {
        if (empty($name)) {
            return $this->createBestClient();
        }

        if (!isset($this->classes[$name])) {
            throw new \InvalidArgumentException(sprintf('The client "%s" is not registered.', $name));
        }

        $class = $this->classes[$name]['class'];
        $client = new $class($this->dispatcher, $this->options, $client);

        if ($client instanceof AbstractHttpClient) {
            return $client;
        }

        throw new \InvalidArgumentException('The client must be an implementation of ClientInterface.');
    }
public function createHttpClient($name = '', $client = null)
    {
        if (empty($name)) {
            return $this->createBestClient();
        }

        if (!isset($this->classes[$name])) {
            throw new \InvalidArgumentException(sprintf('The client "%s" is not registered.', $name));
        }

        $class = $this->classes[$name]['class'];
        $client = new $class($this->dispatcher, $this->options, $client);

        if ($client instanceof AbstractHttpClient) {
            return $client;
        }

        throw new \InvalidArgumentException('The client must be an implementation of ClientInterface.');
    }
public function createHttpClient ( $ name = '' , $ client = null ) { if ( empty ( $ name ) ) { return $ this -> createBestClient ( ) ; } if ( ! isset ( $ this -> classes [ $ name ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The client "%s" is not registered.' , $ name ) ) ; } $ class = $ this -> classes [ $ name ] [ 'class' ] ; $ client = new $ class ( $ this -> dispatcher , $ this -> options , $ client ) ; if ( $ client instanceof AbstractHttpClient ) { return $ client ; } throw new \ InvalidArgumentException ( 'The client must be an implementation of ClientInterface.' ) ; }
Generate the best http client according to the detected configuration

@param  string  $name
@param  null    $client
@return GuzzleAdapter|AbstractHttpClient
@throws \InvalidArgumentException
Generate the best http client according to the detected configuration