RakutenRws_Client::__construct PHP Method

__construct() public method

Constructor.
public __construct ( RakutenRws_HttpClient $httpClient = null, $options = [] )
$httpClient RakutenRws_HttpClient HTTP Client instance
    public function __construct(RakutenRws_HttpClient $httpClient = null, $options = array())
    {
        if (!extension_loaded('openssl')) {
            // @codeCoverageIgnoreStart
            throw new RakutenRws_Exception('openssl extension is not loaded.');
            // @codeCoverageIgnoreEnd
        }
        if ($httpClient === null) {
            // @codeCoverageIgnoreStart
            if (function_exists('curl_init')) {
                $httpClient = new RakutenRws_HttpClient_CurlHttpClient();
            } else {
                if (version_compare(PHP_VERSION, '5.2.10') >= 0) {
                    $httpClient = new RakutenRws_HttpClient_BasicHttpClient();
                } else {
                    if (!@(include 'HTTP/Client.php')) {
                        throw new RakutenRws_Exception('Failed to include Pear HTTP_Client');
                    }
                    $httpClient = new RakutenRws_HttpClient_PearHttpClient();
                }
            }
            // @codeCoverageIgnoreEnd
        }
        $this->httpClient = $httpClient;
        $this->options = $options;
    }