1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ups\Entity; |
4
|
|
|
|
5
|
|
|
use DOMDocument; |
6
|
|
|
use DOMElement; |
7
|
|
|
use Ups\NodeInterface; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class HazMatPackageInformation |
11
|
|
|
* @package Ups\Entity |
12
|
|
|
*/ |
13
|
|
|
class HazMatPackageInformation implements NodeInterface |
14
|
|
|
{ |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @var bool |
18
|
|
|
*/ |
19
|
|
|
private $allPackedInOneIndicator; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var bool |
23
|
|
|
*/ |
24
|
|
|
private $overPackedIndicator; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
private $qValue; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @param null|DOMDocument $document |
33
|
|
|
* |
34
|
|
|
* @return DOMElement |
35
|
|
|
*/ |
36
|
|
|
public function toNode(DOMDocument $document = null) |
37
|
|
|
{ |
38
|
|
|
if (null === $document) { |
39
|
|
|
$document = new DOMDocument(); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
$node = $document->createElement('HazMatPackageInformation'); |
43
|
|
|
|
44
|
|
|
if ($this->isAllPackedInOneIndicator()) { |
45
|
|
|
$node->appendChild($document->createElement('AllPackedInOneIndicator')); |
46
|
|
|
} |
47
|
|
|
if ($this->isOverPackedIndicator()) { |
48
|
|
|
$node->appendChild($document->createElement('OverPackedIndicator')); |
49
|
|
|
} |
50
|
|
|
if ($this->getQValue() !== null) { |
51
|
|
|
$node->appendChild($document->createElement('QValue', $this->getQValue())); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
return $node; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @return bool |
59
|
|
|
*/ |
60
|
|
|
public function isAllPackedInOneIndicator() |
61
|
|
|
{ |
62
|
|
|
return $this->allPackedInOneIndicator; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @param bool $allPackedInOneIndicator |
67
|
|
|
*/ |
68
|
|
|
public function setAllPackedInOneIndicator($allPackedInOneIndicator) |
69
|
|
|
{ |
70
|
|
|
$this->allPackedInOneIndicator = $allPackedInOneIndicator; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return bool |
75
|
|
|
*/ |
76
|
|
|
public function isOverPackedIndicator() |
77
|
|
|
{ |
78
|
|
|
return $this->overPackedIndicator; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param bool $overPackedIndicator |
83
|
|
|
*/ |
84
|
|
|
public function setOverPackedIndicator($overPackedIndicator) |
85
|
|
|
{ |
86
|
|
|
$this->overPackedIndicator = $overPackedIndicator; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @return string |
91
|
|
|
*/ |
92
|
|
|
public function getQValue() |
93
|
|
|
{ |
94
|
|
|
return $this->qValue; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @param string $qValue |
99
|
|
|
*/ |
100
|
|
|
public function setQValue($qValue) |
101
|
|
|
{ |
102
|
|
|
$this->qValue = $qValue; |
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
|