/** * Create and configure a http curl client. * * @param array $settings additional settings * * @return Client */ public function create(array $settings = []) { $stack = null; $settings = $this->platform->toArray() + $settings; if ($this->getLogger() instanceof LoggerInterface) { $stack = HandlerStack::create(); $stack->push(Middleware::log($this->getLogger(), new MessageFormatter('{request} - {response}'))); } return new Client(['base_url' => (string) $settings['url'], 'handler' => $stack, 'exceptions' => false, 'timeout' => (double) $settings['responseTimeout'], 'connection_timeout' => (double) $settings['connectionTimeout']]); }
/** * Return config as an array. * * @return array */ public function toArray() { return ['converter' => $this->getConverter(), 'endpoints' => static::$endPoints, 'platformConfig' => $this->platformConfig->toArray(), 'retry_minutes' => static::DEFAULT_RESPONSE_TIMEOUT, 'soap_headers' => (array) $this->getSoapHeaders()]; }