/** * @param Client $client * @param HttpClientParameters $params * * @see SoapClient::SoapClient() */ public function __construct(Client $client, HttpClientParameters $params = null) { $this->client = $client; if (is_null($params)) { $params = new HttpClientParameters(); } $this->cache = $client->getCache(); $session = $client->getSession(); if (empty($params->baseUrl)) { $base_urls = $client->inDevMode() ? HttpClientParameters::$DEV_BASE_URLS : HttpClientParameters::$BASE_URLS; if (!isset($base_urls[$session->country->id])) { throw new \LogicException("I don't know baseUrl for country '{$session->country}', you have to supply one manually " . "into HttpClientParameters object found in ClientParameters"); } $params->baseUrl = $base_urls[$session->country->id]; } // this may throw $soapClient = new SoapClient(['encoding' => 'UTF-8', 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP, 'cache_wsdl' => WSDL_CACHE_DISK, 'trace' => true, 'user_agent' => $params->userAgent, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'connection_timeout' => $params->connectionTimeout], $params->baseUrl, $this->client); $this->soapClient = $soapClient; }