|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Ups\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use DOMDocument; |
|
6
|
|
|
use DOMElement; |
|
7
|
|
|
use Ups\NodeInterface; |
|
8
|
|
|
|
|
9
|
|
|
class EEIFilingOption implements NodeInterface |
|
10
|
|
|
{ |
|
11
|
|
|
const FO_SHIPPER = '1'; // Shipper Filed |
|
12
|
|
|
const FO_UPS = '3'; // UPS Filed |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* @var string |
|
16
|
|
|
*/ |
|
17
|
|
|
private $code; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @var string |
|
21
|
|
|
*/ |
|
22
|
|
|
private $emailAddress; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @var string |
|
26
|
|
|
*/ |
|
27
|
|
|
private $description; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @var UPSFiled |
|
31
|
|
|
*/ |
|
32
|
|
|
private $upsFiled; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @var ShipperFiled |
|
36
|
|
|
*/ |
|
37
|
|
|
private $shipperFiled; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @param null|object $attributes |
|
41
|
|
|
*/ |
|
42
|
3 |
|
public function __construct($attributes = null) |
|
43
|
|
|
{ |
|
44
|
3 |
|
if (null !== $attributes) { |
|
45
|
2 |
|
if (isset($attributes->Code)) { |
|
46
|
2 |
|
$this->setCode($attributes->Code); |
|
47
|
2 |
|
} |
|
48
|
2 |
|
if (isset($attributes->EmailAddress)) { |
|
49
|
2 |
|
$this->setEmailAddress($attributes->EmailAddress); |
|
50
|
2 |
|
} |
|
51
|
2 |
|
if (isset($attributes->Description)) { |
|
52
|
2 |
|
$this->setDescription($attributes->Description); |
|
53
|
2 |
|
} |
|
54
|
2 |
|
if (isset($attributes->UPSFiled)) { |
|
55
|
2 |
|
$this->setUPSFiled(new UPSFiled($attributes->UPSFiled)); |
|
56
|
2 |
|
} |
|
57
|
2 |
|
if (isset($attributes->ShipperFiled)) { |
|
58
|
2 |
|
$this->setShipperFiled(new ShipperFiled($attributes->ShipperFiled)); |
|
59
|
2 |
|
} |
|
60
|
2 |
|
} |
|
61
|
3 |
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @param null|DOMDocument $document |
|
65
|
|
|
* |
|
66
|
|
|
* @return DOMElement |
|
67
|
|
|
*/ |
|
68
|
1 |
|
public function toNode(DOMDocument $document = null) |
|
69
|
|
|
{ |
|
70
|
1 |
|
if (null === $document) { |
|
71
|
|
|
$document = new DOMDocument(); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
1 |
|
$node = $document->createElement('EEIFilingOption'); |
|
75
|
|
|
|
|
76
|
1 |
|
$code = $this->getCode(); |
|
77
|
1 |
|
if (isset($code)) { |
|
78
|
1 |
|
$node->appendChild($document->createElement('Code', $code)); |
|
79
|
1 |
|
} |
|
80
|
|
|
|
|
81
|
1 |
|
$emailAddress = $this->getEmailAddress(); |
|
82
|
1 |
|
if (isset($emailAddress)) { |
|
83
|
1 |
|
$node->appendChild($document->createElement('EMailAdress', $emailAddress)); |
|
84
|
1 |
|
} |
|
85
|
|
|
|
|
86
|
1 |
|
$description = $this->getDescription(); |
|
87
|
1 |
|
if (isset($description)) { |
|
88
|
1 |
|
$node->appendChild($document->createElement('Description', $description)); |
|
89
|
1 |
|
} |
|
90
|
|
|
|
|
91
|
1 |
|
$upsFiled = $this->getUPSFiled(); |
|
92
|
1 |
|
if (isset($upsFiled)) { |
|
93
|
1 |
|
$node->appendChild($upsFiled->toNode($document)); |
|
94
|
1 |
|
} |
|
95
|
|
|
|
|
96
|
1 |
|
$shipperFiled = $this->getShipperFiled(); |
|
97
|
1 |
|
if (isset($shipperFiled)) { |
|
98
|
1 |
|
$node->appendChild($shipperFiled->toNode($document)); |
|
99
|
1 |
|
} |
|
100
|
|
|
|
|
101
|
1 |
|
return $node; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @return string |
|
106
|
|
|
*/ |
|
107
|
3 |
|
public function getCode() |
|
108
|
|
|
{ |
|
109
|
3 |
|
return $this->code; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* @param string $code |
|
114
|
|
|
* |
|
115
|
|
|
* @return $this |
|
116
|
|
|
*/ |
|
117
|
3 |
|
public function setCode($code) |
|
118
|
|
|
{ |
|
119
|
3 |
|
$this->code = $code; |
|
120
|
|
|
|
|
121
|
3 |
|
return $this; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* @return string |
|
126
|
|
|
*/ |
|
127
|
3 |
|
public function getEmailAddress() |
|
128
|
|
|
{ |
|
129
|
3 |
|
return $this->emailAddress; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* @param string $emailAddress |
|
134
|
|
|
* |
|
135
|
|
|
* @return $this |
|
136
|
|
|
*/ |
|
137
|
3 |
|
public function setEmailAddress($emailAddress) |
|
138
|
|
|
{ |
|
139
|
3 |
|
$this->emailAddress = $emailAddress; |
|
140
|
|
|
|
|
141
|
3 |
|
return $this; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* @return string |
|
146
|
|
|
*/ |
|
147
|
3 |
|
public function getDescription() |
|
148
|
|
|
{ |
|
149
|
3 |
|
return $this->description; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @param string $description |
|
154
|
|
|
* |
|
155
|
|
|
* @return $this |
|
156
|
|
|
*/ |
|
157
|
3 |
|
public function setDescription($description) |
|
158
|
|
|
{ |
|
159
|
3 |
|
$this->description = $description; |
|
160
|
|
|
|
|
161
|
3 |
|
return $this; |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
/** |
|
165
|
|
|
* @return UPSFiled |
|
166
|
|
|
*/ |
|
167
|
3 |
|
public function getUPSFiled() |
|
168
|
|
|
{ |
|
169
|
3 |
|
return $this->upsFiled; |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
/** |
|
173
|
|
|
* @param UPSFiled $upsFiled |
|
174
|
|
|
* |
|
175
|
|
|
* @return $this |
|
176
|
|
|
*/ |
|
177
|
3 |
|
public function setUPSFiled(UPSFiled $upsFiled) |
|
178
|
|
|
{ |
|
179
|
3 |
|
$this->upsFiled = $upsFiled; |
|
180
|
|
|
|
|
181
|
3 |
|
return $this; |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
/** |
|
185
|
|
|
* @return ShipperFiled |
|
186
|
|
|
*/ |
|
187
|
3 |
|
public function getShipperFiled() |
|
188
|
|
|
{ |
|
189
|
3 |
|
return $this->shipperFiled; |
|
190
|
|
|
} |
|
191
|
|
|
|
|
192
|
|
|
/** |
|
193
|
|
|
* @param ShipperFiled $shipperFiled |
|
194
|
|
|
* |
|
195
|
|
|
* @return $this |
|
196
|
|
|
*/ |
|
197
|
3 |
|
public function setShipperFiled(ShipperFiled $shipperFiled) |
|
198
|
|
|
{ |
|
199
|
3 |
|
$this->shipperFiled = $shipperFiled; |
|
200
|
|
|
|
|
201
|
3 |
|
return $this; |
|
202
|
|
|
} |
|
203
|
|
|
} |
|
204
|
|
|
|