CustomerInfo::getOrganisationNumber()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace Loevgaard\AltaPay\Entity;
3
4
use Loevgaard\AltaPay\Hydrator\HydratableInterface;
5
6
class CustomerInfo implements HydratableInterface
7
{
8
    use CountryOfOriginTrait;
9
    use BillingAddressTrait;
10
    use ShippingAddressTrait;
11
    use RegisteredAddressTrait;
12
13
    /**
14
     * @var string
15
     */
16
    private $userAgent;
17
18
    /**
19
     * @var string
20
     */
21
    private $ipAddress;
22
23
    /**
24
     * @var string
25
     */
26
    private $email;
27
28
    /**
29
     * @var string
30
     */
31
    private $username;
32
33
    /**
34
     * @var string
35
     */
36
    private $customerPhone;
37
38
    /**
39
     * @var string
40
     */
41
    private $organisationNumber;
42
43 33
    public function hydrateXml(\SimpleXMLElement $xml)
44
    {
45 33
        if (!isset($xml->CustomerInfo)) {
46 12
            return;
47
        }
48
49
        /** @var \SimpleXMLElement $customerInfo */
50 21
        $customerInfo = $xml->CustomerInfo;
0 ignored issues
show
Bug introduced by
The property CustomerInfo does not seem to exist in SimpleXMLElement.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
51
        
52 21
        $this->userAgent = (string)$customerInfo->UserAgent;
53 21
        $this->ipAddress = (string)$customerInfo->IpAddress;
54 21
        $this->email = (string)$customerInfo->Email;
55 21
        $this->username = (string)$customerInfo->Username;
56 21
        $this->customerPhone = (string)$customerInfo->CustomerPhone;
57 21
        $this->organisationNumber = (string)$customerInfo->OrganisationNumber;
58 21
        $this->hydrateCountryOfOrigin($customerInfo);
59 21
        $this->hydrateBillingAddress($customerInfo);
60 21
        $this->hydrateShippingAddress($customerInfo);
61 21
        $this->hydrateRegisteredAddress($customerInfo);
62 21
    }
63
64
    /**
65
     * @return string
66
     */
67 9
    public function getUserAgent() : ?string
68
    {
69 9
        return $this->userAgent;
70
    }
71
72
    /**
73
     * @return string
74
     */
75 9
    public function getIpAddress() : ?string
76
    {
77 9
        return $this->ipAddress;
78
    }
79
80
    /**
81
     * @return string
82
     */
83 9
    public function getEmail() : ?string
84
    {
85 9
        return $this->email;
86
    }
87
88
    /**
89
     * @return string
90
     */
91 9
    public function getUsername() : ?string
92
    {
93 9
        return $this->username;
94
    }
95
96
    /**
97
     * @return string
98
     */
99 9
    public function getCustomerPhone() : ?string
100
    {
101 9
        return $this->customerPhone;
102
    }
103
104
    /**
105
     * @return string
106
     */
107 9
    public function getOrganisationNumber() : ?string
108
    {
109 9
        return $this->organisationNumber;
110
    }
111
}
112