Completed
Push — master ( e80ea0...ba2e48 )
by Randy
02:42
created

TestPerson::getBirthday()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Dgame\Soap\Test\Object;
4
5
use DateTime;
6
use Dgame\Soap\Attribute\Attribute;
7
use Dgame\Soap\Hydrator\Dom\AssemblableInterface;
8
use Dgame\Soap\XmlElement;
9
use Dgame\Soap\XmlNode;
10
11
/**
12
 * Class TestPerson
13
 * @package Dgame\Soap\Test\Object
14
 */
15
final class TestPerson implements AssemblableInterface
16
{
17
    /**
18
     * @var string
19
     */
20
    private $name;
21
    /**
22
     * @var TestCar
23
     */
24
    private $car;
25
    /**
26
     * @var TestPhone
27
     */
28
    private $phone;
29
    /**
30
     * @var string
31
     */
32
    private $birthplace;
33
    /**
34
     * @var TestAddress
35
     */
36
    private $address;
37
    /**
38
     * @var DateTime
39
     */
40
    private $birthday;
41
    /**
42
     * @var TestHobby
43
     */
44
    public $hobby;
45
46
    /**
47
     * @param string $name
48
     */
49
    public function setName(string $name)
50
    {
51
        $this->name = $name;
52
    }
53
54
    /**
55
     * @param TestCar $car
56
     */
57
    public function setTestCar(TestCar $car)
58
    {
59
        $this->car = $car;
60
    }
61
62
    /**
63
     * @param TestPhone $phone
64
     */
65
    public function setTestPhone(TestPhone $phone)
66
    {
67
        $this->phone = $phone;
68
    }
69
70
    /**
71
     * @param string $birthplace
72
     */
73
    public function setBirthPlace(string $birthplace)
74
    {
75
        $this->birthplace = $birthplace;
76
    }
77
78
    /**
79
     * @param TestAddress $address
80
     */
81
    public function setTestAddress(TestAddress $address)
82
    {
83
        $this->address = $address;
84
    }
85
86
    /**
87
     * @return string
88
     */
89
    public function getName(): string
90
    {
91
        return $this->name;
92
    }
93
94
    /**
95
     * @return TestCar
96
     */
97
    public function getCar(): TestCar
98
    {
99
        return $this->car;
100
    }
101
102
    /**
103
     * @return TestPhone
104
     */
105
    public function getPhone(): TestPhone
106
    {
107
        return $this->phone;
108
    }
109
110
    /**
111
     * @return string
112
     */
113
    public function getBirthPlace(): string
114
    {
115
        return $this->birthplace;
116
    }
117
118
    /**
119
     * @return TestAddress
120
     */
121
    public function getAddress(): TestAddress
122
    {
123
        return $this->address;
124
    }
125
126
    /**
127
     * @return DateTime
128
     */
129
    public function getBirthday(): DateTime
130
    {
131
        return $this->birthday;
132
    }
133
134
    /**
135
     * @param string $birthday
136
     */
137
    public function setBirthday(string $birthday)
138
    {
139
        $this->birthday = new DateTime($birthday);
140
    }
141
142
    /**
143
     * @return XmlElement
144
     */
145
    public function assemble(): XmlElement
146
    {
147
        $node = new XmlNode('person');
148
        $node->setAttribute(new Attribute('name', $this->name));
149
        $node->appendElement($this->car->assemble());
150
        $node->appendElement($this->phone->assemble());
151
        $node->appendElement(new XmlElement('birth-place', $this->birthplace));
152
        $node->appendElement($this->address->assemble());
153
154
        return $node;
155
    }
156
}