Passed
Pull Request — master (#316)
by
unknown
02:30
created

Shipment::getShipmentTotalWeight()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Ups\Entity;
4
5
class Shipment
6
{
7
    const USPS_ENDORSEMENT_RETURN_SERVICE = 1;
8
    const USPS_ENDORSEMENT_FORWARDING_SERVICE = 2;
9
    const USPS_ENDORSEMENT_ADDRESS_SERVICE = 3;
10
    const USPS_ENDORSEMENT_CHANGE_SERVICE = 4;
11
    const USPS_ENDORSEMENT_NO_SERVICE = 5;
12
    /**
13
     * @var PaymentInformation
14
     */
15
    private $paymentInformation;
16
17
    /**
18
     * @var ItemizedPaymentInformation
19
     */
20
    private $itemizedPaymentInformation;
21
22
    /**
23
     * @var RateInformation
24
     */
25
    private $rateInformation;
26
27
    /**
28
     * @var string
29
     */
30
    private $description;
31
32
    /**
33
     * @var Shipper
34
     */
35
    private $shipper;
36
37
    /**
38
     * @var ShipTo;
39
     */
40
    private $shipTo;
41
42
    /**
43
     * @var SoldTo
44
     */
45
    private $soldTo;
46
47
    /**
48
     * @var ShipFrom
49
     */
50
    private $shipFrom;
51
52
    /**
53
     * @var AlternateDeliveryAddress
54
     */
55
    private $alternateDeliveryAddress;
56
57
    /**
58
     * @var ShipmentIndicationType
59
     */
60
    private $shipmentIndicationType;
61
62
    /**
63
     * @var Service
64
     */
65
    private $service;
66
67
    /**
68
     * @var ReturnService
69
     */
70
    private $returnService;
71
72
    /**
73
     * @var bool
74
     */
75
    private $documentsOnly;
76
77
    /**
78
     * @var Package[]
79
     */
80
    private $packages = [];
81
82
    /**
83
     * @var ReferenceNumber
84
     */
85
    private $referenceNumber;
86
87
    /**
88
     * @var ReferenceNumber
89
     */
90
    private $referenceNumber2;
91
92
    /**
93
     * @var ShipmentServiceOptions
94
     */
95
    private $shipmentServiceOptions;
96
97
    /**
98
     * @var bool
99
     */
100
    private $goodsNotInFreeCirculationIndicator;
101
102
    /**
103
     * @var string
104
     */
105
    private $movementReferenceNumber;
106
107
    /**
108
     * @var InvoiceLineTotal
109
     */
110
    private $invoiceLineTotal;
111
112
    /**
113
     * @var ShipmentTotalWeight
114
     */
115
    private $shipmentTotalWeight;
116
117
    /**
118
     * @var string
119
     */
120
    private $numOfPiecesInShipment;
121
122
    /**
123
     * @var DeliveryTimeInformation
124
     */
125
    private $deliveryTimeInformation;
126
    /**
127
     * @var bool
128
     */
129
    private $taxInformationIndicator;
130
    
131
    /**
132
     * Required for Mail Innovations.
133
     * @var integer 
134
     */
135
    private $uspsEndorsement;
136
137
    /**
138
     * Required for Mail Innovations.
139
     * @var string 
140
     */
141
    private $packageId;
142
143
    public function __construct()
144
    {
145
        $this->setShipper(new Shipper());
146
        $this->setShipTo(new ShipTo());
147
        $this->setShipmentServiceOptions(new ShipmentServiceOptions());
148
        $this->setService(new Service());
149
        $this->rateInformation = null;
150
        $this->taxInformationIndicator = false;
151
    }
152
153
    /**
154
     * @return ShipmentIndicationType
155
     */
156
    public function getShipmentIndicationType()
157
    {
158
        return $this->shipmentIndicationType;
159
    }
160
161
    /**
162
     * @param ShipmentIndicationType $shipmentIndicationType
163
     */
164
    public function setShipmentIndicationType(ShipmentIndicationType $shipmentIndicationType)
165
    {
166
        $this->shipmentIndicationType = $shipmentIndicationType;
167
    }
168
169
    /**
170
     * @return AlternateDeliveryAddress
171
     */
172
    public function getAlternateDeliveryAddress()
173
    {
174
        return $this->alternateDeliveryAddress;
175
    }
176
177
    /**
178
     * @param AlternateDeliveryAddress $alternateDeliveryAddress
179
     */
180
    public function setAlternateDeliveryAddress(AlternateDeliveryAddress $alternateDeliveryAddress)
181
    {
182
        $this->alternateDeliveryAddress = $alternateDeliveryAddress;
183
    }
184
185
    /**
186
     * @param Package $package
187
     *
188
     * @return Shipment
189
     */
190
    public function addPackage(Package $package)
191
    {
192
        $packages = $this->getPackages();
193
        $packages[] = $package;
194
        $this->setPackages($packages);
195
196
        return $this;
197
    }
198
199
    /**
200
     * @return string
201
     */
202
    public function getDescription()
203
    {
204
        return $this->description;
205
    }
206
207
    /**
208
     * @param string $description
209
     *
210
     * @return Shipment
211
     */
212
    public function setDescription($description)
213
    {
214
        $this->description = $description;
215
216
        return $this;
217
    }
218
219
    /**
220
     * @param ReferenceNumber $referenceNumber
221
     *
222
     * @return Shipment
223
     */
224
    public function setReferenceNumber(ReferenceNumber $referenceNumber)
225
    {
226
        $this->referenceNumber = $referenceNumber;
227
228
        return $this;
229
    }
230
231
    /**
232
     * @param ReferenceNumber $referenceNumber
233
     *
234
     * @return Shipment
235
     */
236
    public function setReferenceNumber2(ReferenceNumber $referenceNumber)
237
    {
238
        $this->referenceNumber2 = $referenceNumber;
239
240
        return $this;
241
    }
242
243
    /**
244
     * @return ReferenceNumber
245
     */
246
    public function getReferenceNumber()
247
    {
248
        return $this->referenceNumber;
249
    }
250
251
    /**
252
     * @return ReferenceNumber
253
     */
254
    public function getReferenceNumber2()
255
    {
256
        return $this->referenceNumber2;
257
    }
258
259
    /**
260
     * @return bool
261
     */
262
    public function getDocumentsOnly()
263
    {
264
        return $this->documentsOnly;
265
    }
266
267
    /**
268
     * @param bool $documentsOnly
269
     *
270
     * @return Shipment
271
     */
272
    public function setDocumentsOnly($documentsOnly)
273
    {
274
        $this->documentsOnly = $documentsOnly;
275
276
        return $this;
277
    }
278
279
    /**
280
     * @return Package[]
281
     */
282
    public function getPackages()
283
    {
284
        return $this->packages;
285
    }
286
287
    /**
288
     * @param Package[] $packages
289
     *
290
     * @return Shipment
291
     */
292
    public function setPackages(array $packages)
293
    {
294
        $this->packages = $packages;
295
296
        return $this;
297
    }
298
299
    /**
300
     * @return Service
301
     */
302
    public function getService()
303
    {
304
        return $this->service;
305
    }
306
307
    /**
308
     * @param Service $service
309
     *
310
     * @return Shipment
311
     */
312
    public function setService(Service $service)
313
    {
314
        $this->service = $service;
315
316
        return $this;
317
    }
318
319
    /**
320
     * @return ReturnService
321
     */
322
    public function getReturnService()
323
    {
324
        return $this->returnService;
325
    }
326
327
    /**
328
     * @param ReturnService $returnService
329
     *
330
     * @return Shipment
331
     */
332
    public function setReturnService(ReturnService $returnService)
333
    {
334
        $this->returnService = $returnService;
335
336
        return $this;
337
    }
338
339
    /**
340
     * @return ShipFrom
341
     */
342
    public function getShipFrom()
343
    {
344
        return $this->shipFrom;
345
    }
346
347
    /**
348
     * @param ShipFrom $shipFrom
349
     *
350
     * @return Shipment
351
     */
352
    public function setShipFrom(ShipFrom $shipFrom)
353
    {
354
        $this->shipFrom = $shipFrom;
355
356
        return $this;
357
    }
358
359
    /**
360
     * @return ShipTo
361
     */
362
    public function getShipTo()
363
    {
364
        return $this->shipTo;
365
    }
366
367
    /**
368
     * @param ShipTo $shipTo
369
     *
370
     * @return Shipment
371
     */
372
    public function setShipTo(ShipTo $shipTo)
373
    {
374
        $this->shipTo = $shipTo;
375
376
        return $this;
377
    }
378
379
    /**
380
     * @return SoldTo
381
     */
382
    public function getSoldTo()
383
    {
384
        return $this->soldTo;
385
    }
386
387
    /**
388
     * @param SoldTo $soldTo
389
     *
390
     * @return Shipment
391
     */
392
    public function setSoldTo(SoldTo $soldTo)
393
    {
394
        $this->soldTo = $soldTo;
395
396
        return $this;
397
    }
398
399
    /**
400
     * @return ShipmentServiceOptions
401
     */
402
    public function getShipmentServiceOptions()
403
    {
404
        return $this->shipmentServiceOptions;
405
    }
406
407
    /**
408
     * @param ShipmentServiceOptions $shipmentServiceOptions
409
     *
410
     * @return Shipment
411
     */
412
    public function setShipmentServiceOptions(ShipmentServiceOptions $shipmentServiceOptions)
413
    {
414
        $this->shipmentServiceOptions = $shipmentServiceOptions;
415
416
        return $this;
417
    }
418
419
    /**
420
     * @return Shipper
421
     */
422
    public function getShipper()
423
    {
424
        return $this->shipper;
425
    }
426
427
    /**
428
     * @param Shipper $shipper
429
     *
430
     * @return Shipment
431
     */
432
    public function setShipper(Shipper $shipper)
433
    {
434
        $this->shipper = $shipper;
435
436
        return $this;
437
    }
438
439
    /**
440
     * @return PaymentInformation
441
     */
442
    public function getPaymentInformation()
443
    {
444
        return $this->paymentInformation;
445
    }
446
447
    /**
448
     * @param PaymentInformation $paymentInformation
449
     *
450
     * @return Shipment
451
     */
452
    public function setPaymentInformation(PaymentInformation $paymentInformation)
453
    {
454
        $this->paymentInformation = $paymentInformation;
455
456
        return $this;
457
    }
458
459
    /**
460
     * @return ItemizedPaymentInformation
461
     */
462
    public function getItemizedPaymentInformation()
463
    {
464
        return $this->itemizedPaymentInformation;
465
    }
466
467
    /**
468
     * @param ItemizedPaymentInformation $itemizedPaymentInformation
469
     *
470
     * @return Shipment
471
     */
472
    public function setItemizedPaymentInformation(ItemizedPaymentInformation $itemizedPaymentInformation)
473
    {
474
        $this->itemizedPaymentInformation = $itemizedPaymentInformation;
475
476
        return $this;
477
    }
478
479
    /**
480
     * If called, returned prices will include negotiated rates (discounts will be applied).
481
     */
482
    public function showNegotiatedRates()
483
    {
484
        $this->rateInformation = new RateInformation();
485
        $this->rateInformation->setNegotiatedRatesIndicator(true);
486
    }
487
488
    /**
489
     * @return null|RateInformation
490
     */
491
    public function getRateInformation()
492
    {
493
        return $this->rateInformation;
494
    }
495
496
    /**
497
     * @param RateInformation $rateInformation
498
     *
499
     * @return Shipment
500
     */
501
    public function setRateInformation(RateInformation $rateInformation)
502
    {
503
        $this->rateInformation = $rateInformation;
504
505
        return $this;
506
    }
507
508
    /**
509
     * @return boolean
510
     */
511
    public function getGoodsNotInFreeCirculationIndicator()
512
    {
513
        return $this->goodsNotInFreeCirculationIndicator;
514
    }
515
516
    /**
517
     * @param boolean $goodsNotInFreeCirculationIndicator
518
     * @return Shipment
519
     */
520
    public function setGoodsNotInFreeCirculationIndicator($goodsNotInFreeCirculationIndicator)
521
    {
522
        $this->goodsNotInFreeCirculationIndicator = $goodsNotInFreeCirculationIndicator;
523
524
        return $this;
525
    }
526
527
    /**
528
     * @return string
529
     */
530
    public function getMovementReferenceNumber()
531
    {
532
        return $this->movementReferenceNumber;
533
    }
534
535
    /**
536
     * @param string $movementReferenceNumber
537
     * @return Shipment
538
     */
539
    public function setMovementReferenceNumber($movementReferenceNumber)
540
    {
541
        $this->movementReferenceNumber = $movementReferenceNumber;
542
543
        return $this;
544
    }
545
546
    /**
547
     * @return InvoiceLineTotal
548
     */
549
    public function getInvoiceLineTotal()
550
    {
551
        return $this->invoiceLineTotal;
552
    }
553
554
    /**
555
     * @param InvoiceLineTotal $invoiceLineTotal
556
     * @return Shipment
557
     */
558
    public function setInvoiceLineTotal(InvoiceLineTotal $invoiceLineTotal)
559
    {
560
        $this->invoiceLineTotal = $invoiceLineTotal;
561
562
        return $this;
563
    }
564
565
    /**
566
     * @return string
567
     */
568
    public function getNumOfPiecesInShipment()
569
    {
570
        return $this->numOfPiecesInShipment;
571
    }
572
573
    /**
574
     * @param string $numOfPiecesInShipment
575
     * @return Shipment
576
     */
577
    public function setNumOfPiecesInShipment($numOfPiecesInShipment)
578
    {
579
        $this->numOfPiecesInShipment = $numOfPiecesInShipment;
580
581
        return $this;
582
    }
583
584
    /**
585
     * @return DeliveryTimeInformation
586
     */
587
    public function getDeliveryTimeInformation()
588
    {
589
        return $this->deliveryTimeInformation;
590
    }
591
592
    /**
593
     * @param DeliveryTimeInformation $deliveryTimeInformation
594
     */
595
    public function setDeliveryTimeInformation(DeliveryTimeInformation $deliveryTimeInformation)
596
    {
597
        $this->deliveryTimeInformation = $deliveryTimeInformation;
598
    }
599
600
    /**
601
     * @return ShipmentTotalWeight
602
     */
603
    public function getShipmentTotalWeight()
604
    {
605
        return $this->shipmentTotalWeight;
606
    }
607
608
    /**
609
     * @param ShipmentTotalWeight $shipmentTotalWeight
610
     */
611
    public function setShipmentTotalWeight(ShipmentTotalWeight $shipmentTotalWeight)
612
    {
613
        $this->shipmentTotalWeight = $shipmentTotalWeight;
614
    }
615
616
    public function getTaxInformationIndicator(): bool
617
    {
618
        return $this->taxInformationIndicator;
619
    }
620
621
    /**
622
     * If called, returned prices will include Tax Information
623
     */
624
    public function setTaxInformationIndicator(bool $taxInformationIndicator): self
625
    {
626
        $this->taxInformationIndicator = $taxInformationIndicator;
627
        
628
        return $this;
629
    }
630
    
631
    /**
632
     * @return int $uspsEndorsement
633
     */
634
    public function getUSPSEndorsement()
635
    {
636
        return $this->uspsEndorsement;
637
    }
638
639
    /**
640
     * @param integer $uspsEndorsement
641
     *
642
     * @return Shipment
643
     */
644
    public function setUSPSEndorsement($uspsEndorsement)
645
    {
646
        $this->uspsEndorsement = $uspsEndorsement;
647
648
        return $this;
649
    }
650
651
    /**
652
     * @return int $packageId
653
     */
654
    public function getPackageId()
655
    {
656
        return $this->packageId;
657
    }
658
659
    /**
660
     * @param integer $packageId
661
     *
662
     * @return Shipment
663
     */
664
    public function setPackageId($packageId)
665
    {
666
        $this->packageId = $packageId;
0 ignored issues
show
Documentation Bug introduced by
The property $packageId was declared of type string, but $packageId is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
667
        
668
        return $this;
669
    }
670
}
671