Completed
Push — master ( a70bec...ba593a )
by James
03:45
created

SoapClient::__construct()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 21
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 21
rs 9.3142
c 1
b 0
f 0
cc 3
eloc 11
nc 4
nop 2
1
<?php
2
/**
3
 * Contains \jamesiarmes\PhpEws\SoapClient.
4
 */
5
6
namespace jamesiarmes\PhpEws;
7
8
use \jamesiarmes\PhpNtlm\SoapClient as NtlmSoapClient;
9
10
/**
11
 * Handles SOAP communication with the Exchange server using NTLM
12
 * authentication.
13
 *
14
 * @package php-ews\Auth
15
 */
16
class SoapClient extends NtlmSoapClient
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function __construct($wsdl, $options)
22
    {
23
        // If a version was set then add it to the headers.
24
        if (!empty($options['version'])) {
25
            $this->__default_headers[] = new \SoapHeader(
0 ignored issues
show
Bug introduced by
The property __default_headers does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
26
                'http://schemas.microsoft.com/exchange/services/2006/types',
27
                'RequestServerVersion Version="' . $options['version'] . '"'
28
            );
29
        }
30
31
        // If impersonation was set then add it to the headers.
32
        if (!empty($options['impersonation'])) {
33
            $this->__default_headers[] = new \SoapHeader(
34
                'http://schemas.microsoft.com/exchange/services/2006/types',
35
                'ExchangeImpersonation',
36
                $options['impersonation']
37
            );
38
        }
39
40
        parent::__construct($wsdl, $options);
41
    }
42
43
    /**
44
     * Returns the response code from the last request
45
     *
46
     * @return integer
47
     */
48
    public function getResponseCode()
49
    {
50
        return curl_getinfo($this->ch, CURLINFO_HTTP_CODE);
51
    }
52
}
53