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
|
|
|
public function __construct($attributes = null) |
43
|
|
|
{ |
44
|
|
|
if (null !== $attributes) { |
45
|
|
|
if (isset($attributes->Code)) { |
46
|
|
|
$this->setCode($attributes->Code); |
47
|
|
|
} |
48
|
|
|
if (isset($attributes->EmailAddress)) { |
49
|
|
|
$this->setEmailAddress($attributes->EmailAddress); |
50
|
|
|
} |
51
|
|
|
if (isset($attributes->Description)) { |
52
|
|
|
$this->setDescription($attributes->Description); |
53
|
|
|
} |
54
|
|
|
if (isset($attributes->UPSFiled)) { |
55
|
|
|
$this->setUPSFiled(new UPSFiled($attributes->UPSFiled)); |
56
|
|
|
} |
57
|
|
|
if (isset($attributes->ShipperFiled)) { |
58
|
|
|
$this->setShipperFiled(new ShipperFiled($attributes->ShipperFiled)); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @param null|DOMDocument $document |
65
|
|
|
* |
66
|
|
|
* @return DOMElement |
67
|
|
|
*/ |
68
|
|
|
public function toNode(DOMDocument $document = null) |
69
|
|
|
{ |
70
|
|
|
if (null === $document) { |
71
|
|
|
$document = new DOMDocument(); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
$node = $document->createElement('EEIFilingOption'); |
75
|
|
|
|
76
|
|
|
$code = $this->getCode(); |
77
|
|
|
if (isset($code)) { |
78
|
|
|
$node->appendChild($document->createElement('Code', $code)); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
$emailAddress = $this->getEmailAddress(); |
82
|
|
|
if (isset($emailAddress)) { |
83
|
|
|
$node->appendChild($document->createElement('EMailAdress', $emailAddress)); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
$description = $this->getDescription(); |
87
|
|
|
if (isset($description)) { |
88
|
|
|
$node->appendChild($document->createElement('Description', $description)); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
$upsFiled = $this->getUPSFiled(); |
92
|
|
|
if (isset($upsFiled)) { |
93
|
|
|
$node->appendChild($upsFiled->toNode($document)); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
$shipperFiled = $this->getShipperFiled(); |
97
|
|
|
if (isset($shipperFiled)) { |
98
|
|
|
$node->appendChild($shipperFiled->toNode($document)); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
return $node; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @return string |
106
|
|
|
*/ |
107
|
|
|
public function getCode() |
108
|
|
|
{ |
109
|
|
|
return $this->code; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @param string $code |
114
|
|
|
* |
115
|
|
|
* @return $this |
116
|
|
|
*/ |
117
|
|
|
public function setCode($code) |
118
|
|
|
{ |
119
|
|
|
$this->code = $code; |
120
|
|
|
|
121
|
|
|
return $this; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @return string |
126
|
|
|
*/ |
127
|
|
|
public function getEmailAddress() |
128
|
|
|
{ |
129
|
|
|
return $this->emailAddress; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @param string $emailAddress |
134
|
|
|
* |
135
|
|
|
* @return $this |
136
|
|
|
*/ |
137
|
|
|
public function setEmailAddress($emailAddress) |
138
|
|
|
{ |
139
|
|
|
$this->emailAddress = $emailAddress; |
140
|
|
|
|
141
|
|
|
return $this; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @return string |
146
|
|
|
*/ |
147
|
|
|
public function getDescription() |
148
|
|
|
{ |
149
|
|
|
return $this->description; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* @param string $description |
154
|
|
|
* |
155
|
|
|
* @return $this |
156
|
|
|
*/ |
157
|
|
|
public function setDescription($description) |
158
|
|
|
{ |
159
|
|
|
$this->description = $description; |
160
|
|
|
|
161
|
|
|
return $this; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @return UPSFiled |
166
|
|
|
*/ |
167
|
|
|
public function getUPSFiled() |
168
|
|
|
{ |
169
|
|
|
return $this->upsFiled; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @param UPSFiled $upsFiled |
174
|
|
|
* |
175
|
|
|
* @return $this |
176
|
|
|
*/ |
177
|
|
|
public function setUPSFiled(UPSFiled $upsFiled) |
178
|
|
|
{ |
179
|
|
|
$this->upsFiled = $upsFiled; |
180
|
|
|
|
181
|
|
|
return $this; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* @return ShipperFiled |
186
|
|
|
*/ |
187
|
|
|
public function getShipperFiled() |
188
|
|
|
{ |
189
|
|
|
return $this->shipperFiled; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* @param ShipperFiled $shipperFiled |
194
|
|
|
* |
195
|
|
|
* @return $this |
196
|
|
|
*/ |
197
|
|
|
public function setShipperFiled(ShipperFiled $shipperFiled) |
198
|
|
|
{ |
199
|
|
|
$this->shipperFiled = $shipperFiled; |
200
|
|
|
|
201
|
|
|
return $this; |
202
|
|
|
} |
203
|
|
|
} |
204
|
|
|
|