Completed
Push — master ( c98fe8...bf7ad8 )
by Joachim
05:52
created

CountryOfOrigin   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 38
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getCountry() 0 4 1
A getSource() 0 4 1
A hydrateXml() 0 9 2
1
<?php
2
namespace Loevgaard\AltaPay\Entity;
3
4
use Loevgaard\AltaPay\Hydrator\HydratableInterface;
5
6
class CountryOfOrigin implements HydratableInterface
7
{
8
    /**
9
     * @var string
10
     */
11
    private $country;
12
13
    /**
14
     * @var string
15
     */
16
    private $source;
17
18 30
    public function hydrateXml(\SimpleXMLElement $xml)
19
    {
20 30
        if (!isset($xml->CountryOfOrigin)) {
21 3
            return;
22
        }
23
24 27
        $this->country = (string)$xml->CountryOfOrigin->Country;
25 27
        $this->source = (string)$xml->CountryOfOrigin->Source;
26 27
    }
27
28
    /**
29
     * @return string
30
     */
31 9
    public function getCountry() : ?string
32
    {
33 9
        return $this->country;
34
    }
35
36
    /**
37
     * @return string
38
     */
39 9
    public function getSource() : ?string
40
    {
41 9
        return $this->source;
42
    }
43
}
44