<?php
namespace Engine\Soap; class SoapClientOptions { public $trace = 1; public $exceptions = 1; public $features = SOAP_SINGLE_ELEMENT_ARRAYS; public $encoding = 'utf-8'; public $connection_timeout = 10; public $socket_timeout = NULL; public $proxy_host = NULL; public $proxy_port = NULL; public $proxy_login = NULL; public $proxy_password = NULL; public $verify_peer = NULL; public $HTTPHeaders = []; public $localCertificate = [ 'use' => false, 'certificatePath' => null, 'certificatePassword' => null, 'privateKeyPath' => null, ]; protected $classMap = []; public function __construct() { } public function getOptions() { $options = []; if ($this->trace !== NULL) { $options['trace'] = $this->trace; } if ($this->exceptions !== NULL) { $options['exceptions'] = $this->exceptions; } if ($this->features !== NULL) { $options['features'] = $this->features; } if ($this->encoding !== NULL) { $options['enconding'] = $this->encoding; } if ($this->connection_timeout !== NULL) { $options['connection_timeout'] = $this->connection_timeout; } if ($this->proxy_host !== NULL) { $options['proxy_host'] = $this->proxy_host; } if ($this->proxy_port !== NULL) { $options['proxy_port'] = $this->proxy_port; } if ($this->proxy_login !== NULL) { $options['proxy_login'] = $this->proxy_login; } if ($this->proxy_password !== NULL) { $options['proxy_password'] = $this->proxy_password; } if ($this->verify_peer !== NULL) { $options['verify_peer'] = $this->verify_peer; } $options['HTTPHeaders'] = $this->HTTPHeaders; if ($this->classMap) { $options['classmap'] = $this->classMap; } $options['localCertificate'] = null; if ($this->localCertificate && $this->localCertificate['use']) { $options['localCertificate'] = $this->localCertificate; } return $options; } public function addClassMap($xmlClass, $appClass) { $this->classMap[$xmlClass] = $appClass; return $this; } public function setClassMap(Array $map) { foreach ($map as $xmlClass => $appClass) { $this->addClassMap($xmlClass, $appClass); } return $this; } public function addHTTPHeader($key, $value) { $this->HTTPHeaders[]= [ 'key' => $key, 'value' => $value, ]; return $this; } }