AddressTrait::getCountry()   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
3
namespace Loevgaard\AltaPay\Entity;
4
5
trait AddressTrait
6
{
7
    /**
8
     * @var string
9
     */
10
    private $firstName;
11
12
    /**
13
     * @var string
14
     */
15
    private $lastName;
16
17
    /**
18
     * @var string
19
     */
20
    private $address;
21
22
    /**
23
     * @var string
24
     */
25
    private $city;
26
27
    /**
28
     * @var string
29
     */
30
    private $postalCode;
31
32
    /**
33
     * @var string
34
     */
35
    private $country;
36
37
    /**
38
     * @return string
39
     */
40 9
    public function getFirstName() : ?string
41
    {
42 9
        return $this->firstName;
43
    }
44
45
    /**
46
     * @return string
47
     */
48 9
    public function getLastName() : ?string
49
    {
50 9
        return $this->lastName;
51
    }
52
53
    /**
54
     * @return string
55
     */
56 9
    public function getAddress() : ?string
57
    {
58 9
        return $this->address;
59
    }
60
61
    /**
62
     * @return string
63
     */
64 9
    public function getCity() : ?string
65
    {
66 9
        return $this->city;
67
    }
68
69
    /**
70
     * @return string
71
     */
72 9
    public function getPostalCode() : ?string
73
    {
74 9
        return $this->postalCode;
75
    }
76
77
    /**
78
     * @return string
79
     */
80 9
    public function getCountry() : ?string
81
    {
82 9
        return $this->country;
83
    }
84
85
    /**
86
     * @param \SimpleXMLElement $xml
87
     */
88 33
    public function hydrateAddress(\SimpleXMLElement $xml)
89
    {
90 33
        $this->firstName = isset($xml->Firstname) ? (string)$xml->Firstname : null;
91 33
        $this->lastName = isset($xml->Lastname) ? (string)$xml->Lastname : null;
92 33
        $this->address = isset($xml->Address) ? (string)$xml->Address : null;
93 33
        $this->city = isset($xml->City) ? (string)$xml->City : null;
94 33
        $this->postalCode = isset($xml->PostalCode) ? (string)$xml->PostalCode : null;
95 33
        $this->country = isset($xml->Country) ? (string)$xml->Country : null;
96 33
    }
97
}
98