/** * @param string $location * @param string $wsdl * @param array $options */ public function __construct($location, $auth, $wsdl, $options = array()) { $this->auth = $auth; $options = array_replace_recursive(['httpPlayback' => ['mode' => null]], $options); $options['location'] = $location; // If a version was set then add it to the headers. if (!empty($options['version'])) { $this->ewsHeaders['version'] = new SoapHeader('http://schemas.microsoft.com/exchange/services/2006/types', 'RequestServerVersion Version="' . $options['version'] . '"'); } // If impersonation was set then add it to the headers. if (!empty($options['impersonation'])) { $impersonation = $options['impersonation']; if (is_string($impersonation)) { $impersonation = ExchangeImpersonation::fromEmailAddress($options['impersonation']); } $this->ewsHeaders['impersonation'] = new SoapHeader('http://schemas.microsoft.com/exchange/services/2006/types', 'ExchangeImpersonation', $impersonation->toXmlObject()); } if (!empty($options['timezone'])) { $this->ewsHeaders['timezone'] = new SoapHeader('http://schemas.microsoft.com/exchange/services/2006/types', 'TimeZoneContext', array('TimeZoneDefinition' => array('Id' => $options['timezone']))); } $this->httpClient = Factory::getInstance($options['httpPlayback']); parent::__construct($wsdl, $options); }