Completed
Push — master ( ad55a4...c98fe8 )
by Joachim
01:57
created

CustomerInfo::getShippingAddress()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
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
    /**
44
     * @var string
45
     */
46
    private $shippingAddress;
47
48
    /**
49
     * @var string
50
     */
51
    private $registeredAddress;
52
    
53 9
    public function hydrateXml(\SimpleXMLElement $xml)
54
    {
55 9
        if(!isset($xml->CustomerInfo)) {
56
            return;
57
        }
58
59
        /** @var \SimpleXMLElement $customerInfo */
60 9
        $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...
61
        
62 9
        $this->userAgent = (string)$customerInfo->UserAgent;
63 9
        $this->ipAddress = (string)$customerInfo->IpAddress;
64 9
        $this->email = (string)$customerInfo->Email;
65 9
        $this->username = (string)$customerInfo->Username;
66 9
        $this->customerPhone = (string)$customerInfo->CustomerPhone;
67 9
        $this->organisationNumber = (string)$customerInfo->OrganisationNumber;
68 9
        $this->hydrateCountryOfOrigin($customerInfo);
69 9
        $this->hydrateBillingAddress($customerInfo);
70 9
        $this->hydrateShippingAddress($customerInfo);
71 9
        $this->hydrateRegisteredAddress($customerInfo);
72 9
    }
73
74
    /**
75
     * @return string
76
     */
77 3
    public function getUserAgent() : string
78
    {
79 3
        return $this->userAgent;
80
    }
81
82
    /**
83
     * @return string
84
     */
85 3
    public function getIpAddress() : string
86
    {
87 3
        return $this->ipAddress;
88
    }
89
90
    /**
91
     * @return string
92
     */
93 3
    public function getEmail() : string
94
    {
95 3
        return $this->email;
96
    }
97
98
    /**
99
     * @return string
100
     */
101 3
    public function getUsername() : string
102
    {
103 3
        return $this->username;
104
    }
105
106
    /**
107
     * @return string
108
     */
109 3
    public function getCustomerPhone() : string
110
    {
111 3
        return $this->customerPhone;
112
    }
113
114
    /**
115
     * @return string
116
     */
117 3
    public function getOrganisationNumber() : string
118
    {
119 3
        return $this->organisationNumber;
120
    }
121
122
    /**
123
     * @return BillingAddress
124
     */
125 3
    public function getBillingAddress() : BillingAddress
126
    {
127 3
        return $this->billingAddress;
128
    }
129
130
    /**
131
     * @return string
132
     */
133
    public function getShippingAddress() : string
134
    {
135
        return $this->shippingAddress;
136
    }
137
138
    /**
139
     * @return string
140
     */
141
    public function getRegisteredAddress() : string
142
    {
143
        return $this->registeredAddress;
144
    }
145
}
146