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

PaymentNatureService   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 0
dl 0
loc 80
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A isSupportsRefunds() 0 4 1
A isSupportsRelease() 0 4 1
A isSupportsMultipleCaptures() 0 4 1
A isSupportsMultipleRefunds() 0 4 1
A hydrateXml() 0 12 2
1
<?php
2
namespace Loevgaard\AltaPay\Entity;
3
4
use Loevgaard\AltaPay\Hydrator\HydratableInterface;
5
6
class PaymentNatureService implements HydratableInterface
7
{
8
    /**
9
     * @var string
10
     */
11
    private $name;
12
13
    /**
14
     * @var boolean
15
     */
16
    private $supportsRefunds;
17
18
    /**
19
     * @var boolean
20
     */
21
    private $supportsRelease;
22
23
    /**
24
     * @var boolean
25
     */
26
    private $supportsMultipleCaptures;
27
28
    /**
29
     * @var boolean
30
     */
31
    private $supportsMultipleRefunds;
32
33
    /**
34
     * @return string
35
     */
36 3
    public function getName() : string
37
    {
38 3
        return $this->name;
39
    }
40
41
    /**
42
     * @return bool
43
     */
44 3
    public function isSupportsRefunds() : bool
45
    {
46 3
        return $this->supportsRefunds;
47
    }
48
49
    /**
50
     * @return bool
51
     */
52 3
    public function isSupportsRelease() : bool
53
    {
54 3
        return $this->supportsRelease;
55
    }
56
57
    /**
58
     * @return bool
59
     */
60 3
    public function isSupportsMultipleCaptures() : bool
61
    {
62 3
        return $this->supportsMultipleCaptures;
63
    }
64
65
    /**
66
     * @return bool
67
     */
68 3
    public function isSupportsMultipleRefunds() : bool
69
    {
70 3
        return $this->supportsMultipleRefunds;
71
    }
72
73 27
    public function hydrateXml(\SimpleXMLElement $xml)
74
    {
75 27
        if (!isset($xml->PaymentNatureService)) {
76 9
            return;
77
        }
78
79 18
        $this->name = (string)$xml->PaymentNatureService['name'];
80 18
        $this->supportsRefunds = (string)$xml->PaymentNatureService->SupportsRefunds === 'true';
81 18
        $this->supportsRelease = (string)$xml->PaymentNatureService->SupportsRelease === 'true';
82 18
        $this->supportsMultipleCaptures = (string)$xml->PaymentNatureService->SupportsMultipleCaptures === 'true';
83 18
        $this->supportsMultipleRefunds = (string)$xml->PaymentNatureService->SupportsMultipleRefunds === 'true';
84 18
    }
85
}
86