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