1 | <?php |
||
10 | class Shipment implements NodeInterface |
||
11 | { |
||
12 | |||
13 | const TRANSPORT_MODE_AIR = 1; |
||
14 | const TRANSPORT_MODE_GROUND = 2; |
||
15 | const TRANSPORT_MODE_RAIL = 3; |
||
16 | const TRANSPORT_MODE_OCEAN = 4; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | private $originCountryCode; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private $originStateProvinceCode; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | private $destinationCountryCode; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | private $destinationStateProvinceCode; |
||
37 | |||
38 | /** |
||
39 | * @var int |
||
40 | */ |
||
41 | private $transportationMode; |
||
42 | |||
43 | /** |
||
44 | * @var FreightCharges |
||
45 | */ |
||
46 | private $freightCharges; |
||
47 | |||
48 | /** |
||
49 | * @var mixed |
||
50 | */ |
||
51 | private $additionalInsurance; |
||
52 | |||
53 | /** |
||
54 | * @var array |
||
55 | */ |
||
56 | private $products = []; |
||
57 | |||
58 | /** |
||
59 | * @var string |
||
60 | */ |
||
61 | private $resultCurrencyCode; |
||
62 | |||
63 | /** |
||
64 | * @var |
||
65 | */ |
||
66 | private $transactionReferenceId; |
||
67 | |||
68 | /** |
||
69 | * @var int |
||
70 | */ |
||
71 | private $tariffCodeAlert; |
||
72 | |||
73 | /** |
||
74 | * @param null|DOMDocument $document |
||
75 | * |
||
76 | * @return DOMElement |
||
77 | */ |
||
78 | 1 | public function toNode(DOMDocument $document = null) |
|
132 | |||
133 | /** |
||
134 | * @return mixed |
||
135 | */ |
||
136 | public function getAdditionalInsurance() |
||
140 | |||
141 | /** |
||
142 | * @param mixed $additionalInsurance |
||
143 | * |
||
144 | * @return $this |
||
145 | */ |
||
146 | public function setAdditionalInsurance($additionalInsurance) |
||
152 | |||
153 | /** |
||
154 | * @return FreightCharges |
||
155 | */ |
||
156 | 1 | public function getFreightCharges() |
|
160 | |||
161 | /** |
||
162 | * @param FreightCharges $freightCharges |
||
163 | * @return $this |
||
164 | */ |
||
165 | 1 | public function setFreightCharges($freightCharges) |
|
171 | |||
172 | /** |
||
173 | * @return string |
||
174 | */ |
||
175 | 1 | public function getOriginCountryCode() |
|
179 | |||
180 | /** |
||
181 | * @param string $originCountryCode |
||
182 | * @return $this |
||
183 | */ |
||
184 | 1 | public function setOriginCountryCode($originCountryCode) |
|
190 | |||
191 | /** |
||
192 | * @return string |
||
193 | */ |
||
194 | 1 | public function getDestinationCountryCode() |
|
198 | |||
199 | /** |
||
200 | * @param string $destinationCountryCode |
||
201 | * @return $this |
||
202 | */ |
||
203 | 1 | public function setDestinationCountryCode($destinationCountryCode) |
|
209 | |||
210 | /** |
||
211 | * @return string |
||
212 | */ |
||
213 | 1 | public function getOriginStateProvinceCode() |
|
217 | |||
218 | /** |
||
219 | * @param string $originStateProvinceCode |
||
220 | * @return $this |
||
221 | */ |
||
222 | public function setOriginStateProvinceCode($originStateProvinceCode) |
||
228 | |||
229 | /** |
||
230 | * @return string |
||
231 | */ |
||
232 | 1 | public function getDestinationStateProvinceCode() |
|
236 | |||
237 | /** |
||
238 | * @param string $destinationStateProvinceCode |
||
239 | * @return $this |
||
240 | */ |
||
241 | 1 | public function setDestinationStateProvinceCode($destinationStateProvinceCode) |
|
247 | |||
248 | /** |
||
249 | * @return int |
||
250 | */ |
||
251 | 1 | public function getTransportationMode() |
|
255 | |||
256 | /** |
||
257 | * @param int $transportationMode |
||
258 | * @return $this |
||
259 | */ |
||
260 | 1 | public function setTransportationMode($transportationMode) |
|
266 | |||
267 | /** |
||
268 | * @return string |
||
269 | */ |
||
270 | 1 | public function getResultCurrencyCode() |
|
274 | |||
275 | /** |
||
276 | * @param string $resultCurrencyCode |
||
277 | * @return $this |
||
278 | */ |
||
279 | 1 | public function setResultCurrencyCode($resultCurrencyCode) |
|
285 | |||
286 | /** |
||
287 | * @return int |
||
288 | */ |
||
289 | 1 | public function getTariffCodeAlert() |
|
293 | |||
294 | /** |
||
295 | * @param int $tariffCodeAlert |
||
296 | * @return Shipment |
||
297 | */ |
||
298 | 1 | public function setTariffCodeAlert($tariffCodeAlert) |
|
304 | |||
305 | /** |
||
306 | * @return mixed |
||
307 | */ |
||
308 | 1 | public function getTransactionReferenceId() |
|
312 | |||
313 | /** |
||
314 | * @param mixed $transactionReferenceId |
||
315 | * @return $this |
||
316 | */ |
||
317 | public function setTransactionReferenceId($transactionReferenceId) |
||
323 | |||
324 | /** |
||
325 | * @return array |
||
326 | */ |
||
327 | public function getProducts() |
||
331 | |||
332 | /** |
||
333 | * @param array $products |
||
334 | * @return $this |
||
335 | */ |
||
336 | public function setProducts($products) |
||
342 | |||
343 | /** |
||
344 | * @param Product $product |
||
345 | * @return $this |
||
346 | */ |
||
347 | 1 | public function addProduct(Product $product) |
|
353 | } |
||
354 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: