AddressTrait   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 93
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 13
lcom 1
cbo 0
dl 0
loc 93
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getFirstName() 0 4 1
A getLastName() 0 4 1
A getAddress() 0 4 1
A getCity() 0 4 1
A getPostalCode() 0 4 1
A getCountry() 0 4 1
B hydrateAddress() 0 9 7
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