Passed
Push — master ( e6b5d5...e7a28f )
by
unknown
40s
created

ItemizedPaymentInformation   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 11
lcom 1
cbo 1
dl 0
loc 82
ccs 0
cts 28
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 4
A getTransportationShipmentCharge() 0 4 1
A setShipmentCharge() 0 11 3
A getDutiesAndTaxesShipmentCharge() 0 4 1
A getSplitDutyVATIndicator() 0 4 1
A setSplitDutyVATIndicator() 0 6 1
1
<?php
2
3
namespace Ups\Entity;
4
5
use LogicException;
6
7
class ItemizedPaymentInformation
8
{
9
10
    /**
11
     * @var bool
12
     */
13
    private $splitDutyVATIndicator;
14
15
    /**
16
     * @var transportationShipmentCharge
17
     */
18
    private $transportationShipmentCharge;
19
20
    /**
21
     * @var dutiesAndTaxesShipmentCharge
22
     */
23
    private $dutiesAndTaxesShipmentCharge;
24
25
    public function __construct($transportationShipmentCharge = null, $dutiesAndTaxesShipmentCharge = null, $splitDutyVATIndicator = null)
26
    {
27
        if ($transportationShipmentCharge) {
28
            $this->setShipmentCharge($transportationShipmentCharge);
29
        }
30
        if ($dutiesAndTaxesShipmentCharge) {
31
            $this->setShipmentCharge($dutiesAndTaxesShipmentCharge);
32
        }
33
        if ($splitDutyVATIndicator) {
34
            $this->setSplitDutyVATIndicator($splitDutyVATIndicator);
35
        }
36
    }
37
38
    /**
39
     * @return transportationShipmentCharge
40
     */
41
    public function getTransportationShipmentCharge()
42
    {
43
        return $this->transportationShipmentCharge;
44
    }
45
46
    /**
47
     * @param ShipmentCharge $shipmentCharge
48
     * @return ItemizedPaymentInformation
49
     */
50
    public function setShipmentCharge(ShipmentCharge $shipmentCharge)
51
    {
52
        if ($shipmentCharge->getType() === ShipmentCharge::SHIPMENT_CHARGE_TYPE_TRANSPORTATION) {
53
            $this->transportationShipmentCharge = $shipmentCharge;
0 ignored issues
show
Documentation Bug introduced by
It seems like $shipmentCharge of type object<Ups\Entity\ShipmentCharge> is incompatible with the declared type object<Ups\Entity\transportationShipmentCharge> of property $transportationShipmentCharge.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
54
        } elseif ($shipmentCharge->getType() === ShipmentCharge::SHIPMENT_CHARGE_TYPE_DUTIES) {
55
            $this->dutiesAndTaxesShipmentCharge = $shipmentCharge;
0 ignored issues
show
Documentation Bug introduced by
It seems like $shipmentCharge of type object<Ups\Entity\ShipmentCharge> is incompatible with the declared type object<Ups\Entity\dutiesAndTaxesShipmentCharge> of property $dutiesAndTaxesShipmentCharge.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
56
        } else {
57
            throw new LogicException(sprintf('Unknown ShipmentCharge charge type requested: "%s"', $type));
58
        }
59
        return $this;
60
    }
61
62
    /**
63
     * @return DutiesAndTaxesShipmentCharge
64
     */
65
    public function getDutiesAndTaxesShipmentCharge()
66
    {
67
        return $this->dutiesAndTaxesShipmentCharge;
68
    }
69
70
    /**
71
     * @return bool
72
     */
73
    public function getSplitDutyVATIndicator()
74
    {
75
        return $this->splitDutyVATIndicator;
76
    }
77
78
    /**
79
     * @param bool $splitDutyVATIndicator
80
     * @return ItemizedPaymentInformation
81
     */
82
    public function setSplitDutyVATIndicator($splitDutyVATIndicator)
83
    {
84
        $this->splitDutyVATIndicator = $splitDutyVATIndicator;
85
86
        return $this;
87
    }
88
}
89