1 | <?php |
||
9 | class PackageWeight implements NodeInterface |
||
10 | { |
||
11 | /** @deprecated */ |
||
12 | public $UnitOfMeasurement; |
||
13 | |||
14 | /** @deprecated */ |
||
15 | public $Weight; |
||
16 | |||
17 | /** |
||
18 | * @var UnitOfMeasurement |
||
19 | */ |
||
20 | private $unitOfMeasurement; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $weight; |
||
26 | |||
27 | 2 | public function __construct($attributes = null) |
|
28 | { |
||
29 | 2 | $this->setUnitOfMeasurement(new UnitOfMeasurement( |
|
30 | 2 | isset($attributes->UnitOfMeasurement) ? $attributes->UnitOfMeasurement : null |
|
31 | 2 | )); |
|
32 | 2 | if (isset($attributes->Weight)) { |
|
33 | $this->setWeight($attributes->Weight); |
||
34 | } |
||
35 | 2 | } |
|
36 | |||
37 | /** |
||
38 | * @param null|DOMDocument $document |
||
39 | * |
||
40 | * @return DOMElement |
||
41 | */ |
||
42 | 2 | public function toNode(DOMDocument $document = null) |
|
43 | { |
||
44 | 2 | if (null === $document) { |
|
45 | $document = new DOMDocument(); |
||
46 | } |
||
47 | |||
48 | 2 | $node = $document->createElement('PackageWeight'); |
|
49 | 2 | $node->appendChild($document->createElement('Weight', $this->getWeight())); |
|
50 | 2 | $node->appendChild($this->getUnitOfMeasurement()->toNode($document)); |
|
51 | |||
52 | 2 | return $node; |
|
53 | } |
||
54 | |||
55 | /** |
||
56 | * @return UnitOfMeasurement |
||
57 | */ |
||
58 | 2 | public function getUnitOfMeasurement() |
|
59 | { |
||
60 | 2 | return $this->unitOfMeasurement; |
|
61 | } |
||
62 | |||
63 | /** |
||
64 | * @param UnitOfMeasurement $unitOfMeasurement |
||
65 | * |
||
66 | * @return $this |
||
67 | */ |
||
68 | 2 | public function setUnitOfMeasurement(UnitOfMeasurement $unitOfMeasurement) |
|
69 | { |
||
70 | 2 | $this->UnitOfMeasurement = $unitOfMeasurement; |
|
|
|||
71 | 2 | $this->unitOfMeasurement = $unitOfMeasurement; |
|
72 | |||
73 | 2 | return $this; |
|
74 | } |
||
75 | |||
76 | /** |
||
77 | * @return string |
||
78 | */ |
||
79 | 2 | public function getWeight() |
|
80 | { |
||
81 | 2 | return $this->weight; |
|
82 | } |
||
83 | |||
84 | /** |
||
85 | * @param string $weight |
||
86 | * |
||
87 | * @return $this |
||
88 | */ |
||
89 | public function setWeight($weight) |
||
96 | } |
||
97 |
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.