Passed
Push — master ( 2b63db...3a2bd9 )
by Stefan
07:15
created

ShipTo::setAddress()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 7
ccs 0
cts 4
cp 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Ups\Entity;
4
5
use DOMDocument;
6
use DOMElement;
7
use Ups\NodeInterface;
8
9
class ShipTo implements NodeInterface
10
{
11
    /** @deprecated */
12
    public $LocationID;
13
    /** @deprecated */
14
    public $ReceivingAddressName;
15
    /** @deprecated */
16
    public $Bookmark;
17
    /** @deprecated */
18
    public $ShipperAssignedIdentificationNumber;
19
    /** @deprecated */
20
    public $CompanyName;
21
    /** @deprecated */
22
    public $AttentionName;
23
    /** @deprecated */
24
    public $PhoneNumber;
25
    /** @deprecated */
26
    public $TaxIdentificationNumber;
27
    /** @deprecated */
28
    public $FaxNumber;
29
    /** @deprecated */
30
    public $EMailAddress;
31
    /** @deprecated */
32
    public $Address;
33
34
    /**
35
     * @var string
36
     */
37
    private $locationId;
38
39
    /**
40
     * @var string
41
     */
42
    private $receivingAddressName;
43
44
    /**
45
     * @var string
46
     */
47
    private $bookmark;
48
49
    /**
50
     * @var string
51
     */
52
    private $shipperAssignedIdentificationNumber;
53
54
    /**
55
     * @var string
56
     */
57
    private $companyName;
58
59
    /**
60
     * @var string
61
     */
62
    private $attentionName;
63
64
    /**
65
     * @var string
66
     */
67
    private $phoneNumber;
68
69
    /**
70
     * @var string
71
     */
72
    private $taxIdentificationNumber;
73
74
    /**
75
     * @var string
76
     */
77
    private $faxNumber;
78
79
    /**
80
     * @var string
81
     */
82
    private $emailAddress;
83
84
    /**
85
     * @var Address
86
     */
87
    private $address;
88
89
    /**
90
     * @param null|object $attributes
91
     */
92 1
    public function __construct($attributes = null)
93
    {
94 1
        $this->address = new Address();
95
96 1
        if (null != $attributes) {
97
            if (isset($attributes->LocationID)) {
98
                $this->setLocationId($attributes->LocationID);
99
            }
100
            if (isset($attributes->ReceivingAddressName)) {
101
                $this->setReceivingAddressName($attributes->ReceivingAddressName);
102
            }
103
            if (isset($attributes->Bookmark)) {
104
                $this->setBookmark($attributes->Bookmark);
105
            }
106
            if (isset($attributes->ShipperAssignedIdentificationNumber)) {
107
                $this->setShipperAssignedIdentificationNumber($attributes->ShipperAssignedIdentificationNumber);
108
            }
109
            if (isset($attributes->CompanyName)) {
110
                $this->setCompanyName($attributes->CompanyName);
111
            }
112
            if (isset($attributes->AttentionName)) {
113
                $this->setAttentionName($attributes->AttentionName);
114
            }
115
            if (isset($attributes->PhoneNumber)) {
116
                $this->setPhoneNumber($attributes->PhoneNumber);
117
            }
118
            if (isset($attributes->TaxIdentificationNumber)) {
119
                $this->setTaxIdentificationNumber($attributes->TaxIdentificationNumber);
120
            }
121
            if (isset($attributes->FaxNumber)) {
122
                $this->setFaxNumber($attributes->FaxNumber);
123
            }
124
            if (isset($attributes->EMailAddress)) {
125
                $this->setEmailAddress($attributes->EMailAddress);
126
            }
127
            if (isset($attributes->Address)) {
128
                $this->setAddress(new Address($attributes->Address));
129
            }
130
        }
131 1
    }
132
133
    /**
134
     * @param null|DOMDocument $document
135
     *
136
     * @return DOMElement
137
     */
138 View Code Duplication
    public function toNode(DOMDocument $document = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
139
    {
140
        if (null === $document) {
141
            $document = new DOMDocument();
142
        }
143
144
        $node = $document->createElement('ShipTo');
145
        $node->appendChild($document->createElement('CompanyName', $this->getCompanyName()));
146
        $node->appendChild($document->createElement('AttentionName', $this->getAttentionName()));
147
148
        $address = $this->getAddress();
149
        if (isset($address)) {
150
            $node->appendChild($address->toNode($document));
151
        }
152
153
        return $node;
154
    }
155
156
    /**
157
     * @return Address
158
     */
159
    public function getAddress()
160
    {
161
        return $this->address;
162
    }
163
164
    /**
165
     * @param Address $address
166
     *
167
     * @return $this
168
     */
169
    public function setAddress(Address $address)
170
    {
171
        $this->Address = $address;
0 ignored issues
show
Deprecated Code introduced by
The property Ups\Entity\ShipTo::$Address has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
172
        $this->address = $address;
173
174
        return $this;
175
    }
176
177
    /**
178
     * @return string
179
     */
180
    public function getAttentionName()
181
    {
182
        return $this->attentionName;
183
    }
184
185
    /**
186
     * @param string $attentionName
187
     *
188
     * @return $this
189
     */
190
    public function setAttentionName($attentionName)
191
    {
192
        $this->AttentionName = $attentionName;
0 ignored issues
show
Deprecated Code introduced by
The property Ups\Entity\ShipTo::$AttentionName has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
193
        $this->attentionName = $attentionName;
194
195
        return $this;
196
    }
197
198
    /**
199
     * @return string
200
     */
201
    public function getBookmark()
202
    {
203
        return $this->bookmark;
204
    }
205
206
    /**
207
     * @param string $bookmark
208
     *
209
     * @return $this
210
     */
211
    public function setBookmark($bookmark)
212
    {
213
        $this->Bookmark = $bookmark;
0 ignored issues
show
Deprecated Code introduced by
The property Ups\Entity\ShipTo::$Bookmark has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
214
        $this->bookmark = $bookmark;
215
216
        return $this;
217
    }
218
219
    /**
220
     * @return string
221
     */
222
    public function getCompanyName()
223
    {
224
        return $this->companyName;
225
    }
226
227
    /**
228
     * @param string $companyName
229
     *
230
     * @return $this
231
     */
232
    public function setCompanyName($companyName)
233
    {
234
        $this->CompanyName = $companyName;
0 ignored issues
show
Deprecated Code introduced by
The property Ups\Entity\ShipTo::$CompanyName has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
235
        $this->companyName = $companyName;
236
237
        return $this;
238
    }
239
240
    /**
241
     * @return string
242
     */
243
    public function getEmailAddress()
244
    {
245
        return $this->emailAddress;
246
    }
247
248
    /**
249
     * @param string $emailAddress
250
     *
251
     * @return $this
252
     */
253
    public function setEmailAddress($emailAddress)
254
    {
255
        $this->EMailAddress = $emailAddress;
0 ignored issues
show
Deprecated Code introduced by
The property Ups\Entity\ShipTo::$EMailAddress has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
256
        $this->emailAddress = $emailAddress;
257
258
        return $this;
259
    }
260
261
    /**
262
     * @return string
263
     */
264
    public function getFaxNumber()
265
    {
266
        return $this->faxNumber;
267
    }
268
269
    /**
270
     * @param string $faxNumber
271
     *
272
     * @return $this
273
     */
274
    public function setFaxNumber($faxNumber)
275
    {
276
        $this->FaxNumber = $faxNumber;
0 ignored issues
show
Deprecated Code introduced by
The property Ups\Entity\ShipTo::$FaxNumber has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
277
        $this->faxNumber = $faxNumber;
278
279
        return $this;
280
    }
281
282
    /**
283
     * @return string
284
     */
285
    public function getLocationId()
286
    {
287
        return $this->locationId;
288
    }
289
290
    /**
291
     * @param string $locationId
292
     *
293
     * @return $this
294
     */
295
    public function setLocationId($locationId)
296
    {
297
        $this->LocationID = $locationId;
0 ignored issues
show
Deprecated Code introduced by
The property Ups\Entity\ShipTo::$LocationID has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
298
        $this->locationId = $locationId;
299
300
        return $this;
301
    }
302
303
    /**
304
     * @return string
305
     */
306
    public function getPhoneNumber()
307
    {
308
        return $this->phoneNumber;
309
    }
310
311
    /**
312
     * @param string $phoneNumber
313
     *
314
     * @return $this
315
     */
316
    public function setPhoneNumber($phoneNumber)
317
    {
318
        $this->PhoneNumber = $phoneNumber;
0 ignored issues
show
Deprecated Code introduced by
The property Ups\Entity\ShipTo::$PhoneNumber has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
319
        $this->phoneNumber = $phoneNumber;
320
321
        return $this;
322
    }
323
324
    /**
325
     * @return string
326
     */
327
    public function getReceivingAddressName()
328
    {
329
        return $this->receivingAddressName;
330
    }
331
332
    /**
333
     * @param string $receivingAddressName
334
     *
335
     * @return $this
336
     */
337
    public function setReceivingAddressName($receivingAddressName)
338
    {
339
        $this->ReceivingAddressName = $receivingAddressName;
0 ignored issues
show
Deprecated Code introduced by
The property Ups\Entity\ShipTo::$ReceivingAddressName has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
340
        $this->receivingAddressName = $receivingAddressName;
341
342
        return $this;
343
    }
344
345
    /**
346
     * @return string
347
     */
348
    public function getShipperAssignedIdentificationNumber()
349
    {
350
        return $this->shipperAssignedIdentificationNumber;
351
    }
352
353
    /**
354
     * @param string $shipperAssignedIdentificationNumber
355
     *
356
     * @return $this
357
     */
358
    public function setShipperAssignedIdentificationNumber($shipperAssignedIdentificationNumber)
359
    {
360
        $this->ShipperAssignedIdentificationNumber = $shipperAssignedIdentificationNumber;
0 ignored issues
show
Deprecated Code introduced by
The property Ups\Entity\ShipTo::$Ship...nedIdentificationNumber has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
361
        $this->shipperAssignedIdentificationNumber = $shipperAssignedIdentificationNumber;
362
363
        return $this;
364
    }
365
366
    /**
367
     * @return string
368
     */
369
    public function getTaxIdentificationNumber()
370
    {
371
        return $this->taxIdentificationNumber;
372
    }
373
374
    /**
375
     * @param string $taxIdentificationNumber
376
     *
377
     * @return $this
378
     */
379
    public function setTaxIdentificationNumber($taxIdentificationNumber)
380
    {
381
        $this->TaxIdentificationNumber = $taxIdentificationNumber;
0 ignored issues
show
Deprecated Code introduced by
The property Ups\Entity\ShipTo::$TaxIdentificationNumber has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
382
        $this->taxIdentificationNumber = $taxIdentificationNumber;
383
384
        return $this;
385
    }
386
}
387