1 | <?php |
||
9 | class Shipper implements NodeInterface |
||
10 | { |
||
11 | /** |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $name; |
||
15 | |||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $companyName; |
||
20 | |||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $attentionName; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $taxIdentificationNumber; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $phoneNumber; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $faxNumber; |
||
40 | |||
41 | /** |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $shipperNumber; |
||
45 | |||
46 | /** |
||
47 | * @var string |
||
48 | */ |
||
49 | protected $emailAddress; |
||
50 | |||
51 | /** |
||
52 | * @var Address |
||
53 | */ |
||
54 | protected $address; |
||
55 | |||
56 | /** |
||
57 | * @param null|object $attributes |
||
58 | */ |
||
59 | 1 | public function __construct($attributes = null) |
|
60 | { |
||
61 | 1 | $this->address = new Address(); |
|
62 | |||
63 | 1 | if (null !== $attributes) { |
|
64 | if (isset($attributes->Name)) { |
||
65 | $this->setName($attributes->Name); |
||
66 | } |
||
67 | if (isset($attributes->CompanyName)) { |
||
68 | $this->setCompanyName($attributes->CompanyName); |
||
69 | } |
||
70 | if (isset($attributes->AttentionName)) { |
||
71 | $this->setAttentionName($attributes->AttentionName); |
||
72 | } |
||
73 | if (isset($attributes->TaxIdentificationNumber)) { |
||
74 | $this->setTaxIdentificationNumber($attributes->TaxIdentificationNumber); |
||
75 | } |
||
76 | if (isset($attributes->PhoneNumber)) { |
||
77 | $this->setPhoneNumber($attributes->PhoneNumber); |
||
78 | } |
||
79 | if (isset($attributes->FaxNumber)) { |
||
80 | $this->setFaxNumber($attributes->FaxNumber); |
||
81 | } |
||
82 | if (isset($attributes->ShipperNumber)) { |
||
83 | $this->setShipperNumber($attributes->ShipperNumber); |
||
84 | } |
||
85 | if (isset($attributes->EMailAddress)) { |
||
86 | $this->setEmailAddress($attributes->EMailAddress); |
||
87 | } |
||
88 | if (isset($attributes->Address)) { |
||
89 | $this->setAddress(new Address($attributes->Address)); |
||
90 | } |
||
91 | } |
||
92 | 1 | } |
|
93 | |||
94 | /** |
||
95 | * @param null|DOMDocument $document |
||
96 | * |
||
97 | * @return DOMElement |
||
98 | */ |
||
99 | public function toNode(DOMDocument $document = null) |
||
100 | { |
||
101 | if (null === $document) { |
||
102 | $document = new DOMDocument(); |
||
103 | } |
||
104 | |||
105 | $node = $document->createElement('Shipper'); |
||
106 | |||
107 | $shipperName = $this->getName(); |
||
108 | if (isset($shipperName)) { |
||
109 | $node->appendChild($document->createElement('Name', $shipperName)); |
||
110 | } |
||
111 | |||
112 | $shipperNumber = $this->getShipperNumber(); |
||
113 | if (isset($shipperNumber)) { |
||
114 | $node->appendChild($document->createElement('ShipperNumber', $shipperNumber)); |
||
115 | } |
||
116 | |||
117 | $address = $this->getAddress(); |
||
118 | if (isset($address)) { |
||
119 | $node->appendChild($address->toNode($document)); |
||
120 | } |
||
121 | |||
122 | return $node; |
||
123 | } |
||
124 | |||
125 | /** |
||
126 | * @return Address |
||
127 | */ |
||
128 | public function getAddress() |
||
132 | |||
133 | /** |
||
134 | * @param Address $address |
||
135 | * |
||
136 | * @return Shipper |
||
137 | */ |
||
138 | public function setAddress(Address $address) |
||
139 | { |
||
140 | $this->address = $address; |
||
141 | |||
142 | return $this; |
||
143 | } |
||
144 | |||
145 | /** |
||
146 | * @return string |
||
147 | */ |
||
148 | public function getAttentionName() |
||
152 | |||
153 | /** |
||
154 | * @param string $attentionName |
||
155 | * |
||
156 | * @return Shipper |
||
157 | */ |
||
158 | public function setAttentionName($attentionName) |
||
159 | { |
||
160 | $this->attentionName = $attentionName; |
||
161 | |||
162 | return $this; |
||
163 | } |
||
164 | |||
165 | /** |
||
166 | * @return string |
||
167 | */ |
||
168 | public function getEmailAddress() |
||
172 | |||
173 | /** |
||
174 | * @param string $emailAddress |
||
175 | * |
||
176 | * @return Shipper |
||
177 | */ |
||
178 | public function setEmailAddress($emailAddress) |
||
179 | { |
||
180 | $this->emailAddress = $emailAddress; |
||
181 | |||
182 | return $this; |
||
183 | } |
||
184 | |||
185 | /** |
||
186 | * @return string |
||
187 | */ |
||
188 | public function getFaxNumber() |
||
192 | |||
193 | /** |
||
194 | * @param string $faxNumber |
||
195 | * |
||
196 | * @return Shipper |
||
197 | */ |
||
198 | public function setFaxNumber($faxNumber) |
||
199 | { |
||
200 | $this->faxNumber = $faxNumber; |
||
201 | |||
202 | return $this; |
||
203 | } |
||
204 | |||
205 | /** |
||
206 | * @return string |
||
207 | */ |
||
208 | public function getName() |
||
212 | |||
213 | /** |
||
214 | * @param string $name |
||
215 | * |
||
216 | * @return Shipper |
||
217 | */ |
||
218 | public function setName($name) |
||
219 | { |
||
220 | $this->name = $name; |
||
221 | |||
222 | return $this; |
||
223 | } |
||
224 | |||
225 | /** |
||
226 | * @return string |
||
227 | */ |
||
228 | public function getPhoneNumber() |
||
232 | |||
233 | /** |
||
234 | * @param string $phoneNumber |
||
235 | * |
||
236 | * @return Shipper |
||
237 | */ |
||
238 | public function setPhoneNumber($phoneNumber) |
||
239 | { |
||
240 | $this->phoneNumber = $phoneNumber; |
||
241 | |||
242 | return $this; |
||
243 | } |
||
244 | |||
245 | /** |
||
246 | * @return string |
||
247 | */ |
||
248 | public function getShipperNumber() |
||
252 | |||
253 | /** |
||
254 | * @param string $shipperNumber |
||
255 | * |
||
256 | * @return Shipper |
||
257 | */ |
||
258 | public function setShipperNumber($shipperNumber) |
||
259 | { |
||
260 | $this->shipperNumber = $shipperNumber; |
||
261 | |||
262 | return $this; |
||
263 | } |
||
264 | |||
265 | /** |
||
266 | * @return string |
||
267 | */ |
||
268 | public function getTaxIdentificationNumber() |
||
272 | |||
273 | /** |
||
274 | * @param string $taxIdentificationNumber |
||
275 | * |
||
276 | * @return Shipper |
||
277 | */ |
||
278 | public function setTaxIdentificationNumber($taxIdentificationNumber) |
||
279 | { |
||
280 | $this->taxIdentificationNumber = $taxIdentificationNumber; |
||
281 | |||
282 | return $this; |
||
283 | } |
||
284 | |||
285 | /** |
||
286 | * @return string |
||
287 | */ |
||
288 | public function getCompanyName() |
||
292 | |||
293 | /** |
||
294 | * @param string $companyName |
||
295 | * @return Shipper |
||
296 | */ |
||
297 | public function setCompanyName($companyName = null) |
||
298 | { |
||
299 | $this->companyName = $companyName; |
||
300 | |||
301 | return $this; |
||
302 | } |
||
303 | } |
||
304 |