Passed
Branch master (7a0b0e)
by Randy
02:56
created

Person   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 118
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

Changes 0
Metric Value
wmc 11
lcom 1
cbo 7
dl 0
loc 118
rs 10
c 0
b 0
f 0

11 Methods

Rating   Name   Duplication   Size   Complexity  
A setName() 0 4 1
A setCar() 0 4 1
A setPhone() 0 4 1
A setBirthPlace() 0 4 1
A setAddress() 0 4 1
A getName() 0 4 1
A getCar() 0 4 1
A getPhone() 0 4 1
A getBirthPlace() 0 4 1
A getAddress() 0 4 1
A assemble() 0 11 1
1
<?php
2
3
namespace Dgame\Soap\Test\Object;
4
5
use Dgame\Soap\Attribute\Attribute;
6
use Dgame\Soap\Element;
7
use Dgame\Soap\Hydrator\Dom\AssemblableInterface;
8
use Dgame\Soap\Hydrator\Hydratable;
9
use Dgame\Soap\XmlNode;
10
11
/**
12
 * Class Person
13
 * @package Dgame\Soap\Test\Object
14
 */
15
final class Person extends Hydratable implements AssemblableInterface
16
{
17
    /**
18
     * @var string
19
     */
20
    private $name;
21
    /**
22
     * @var Car
23
     */
24
    private $car;
25
    /**
26
     * @var Phone
27
     */
28
    private $phone;
29
    /**
30
     * @var string
31
     */
32
    private $birthplace;
33
    /**
34
     * @var Address
35
     */
36
    private $address;
37
38
    /**
39
     * @param string $name
40
     */
41
    public function setName(string $name)
42
    {
43
        $this->name = $name;
44
    }
45
46
    /**
47
     * @param Car $car
48
     */
49
    public function setCar(Car $car)
50
    {
51
        $this->car = $car;
52
    }
53
54
    /**
55
     * @param Phone $phone
56
     */
57
    public function setPhone(Phone $phone)
58
    {
59
        $this->phone = $phone;
60
    }
61
62
    /**
63
     * @param string $birthplace
64
     */
65
    public function setBirthPlace(string $birthplace)
66
    {
67
        $this->birthplace = $birthplace;
68
    }
69
70
    /**
71
     * @param Address $address
72
     */
73
    public function setAddress(Address $address)
74
    {
75
        $this->address = $address;
76
    }
77
78
    /**
79
     * @return string
80
     */
81
    public function getName(): string
82
    {
83
        return $this->name;
84
    }
85
86
    /**
87
     * @return Car
88
     */
89
    public function getCar(): Car
90
    {
91
        return $this->car;
92
    }
93
94
    /**
95
     * @return Phone
96
     */
97
    public function getPhone(): Phone
98
    {
99
        return $this->phone;
100
    }
101
102
    /**
103
     * @return string
104
     */
105
    public function getBirthPlace(): string
106
    {
107
        return $this->birthplace;
108
    }
109
110
    /**
111
     * @return Address
112
     */
113
    public function getAddress(): Address
114
    {
115
        return $this->address;
116
    }
117
118
    /**
119
     * @return Element
120
     */
121
    public function assemble(): Element
122
    {
123
        $node = new XmlNode('person');
124
        $node->setAttribute(new Attribute('name', $this->name));
125
        $node->appendChild($this->car->assemble());
126
        $node->appendChild($this->phone->assemble());
127
        $node->appendChild(new Element('birth-place', $this->birthplace));
128
        $node->appendChild($this->address->assemble());
129
130
        return $node;
131
    }
132
}