Passed
Pull Request — master (#151)
by
unknown
05:33 queued 02:22
created

ShipmentCharge::getConsigneeBilled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

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
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Ups\Entity;
4
5
use DOMDocument;
6
7
class ShipmentCharge
8
{
9
    const TYPE_TRANSPORTATION = '01';
10
    const TYPE_DUTY_AND_TAX   = '02';
11
12
    /**
13
     * @var string
14
     */
15
    private $type;
16
17
    /**
18
     * @var BillShipper
19
     */
20
    private $billShipper;
21
22
    /**
23
     * @var bool
24
     */
25
    private $consigneeBilled;
26
27
    public function __construct($attributes = null)
28
    {
29
        if ($attributes === null) {
30
            return $this;
0 ignored issues
show
Bug introduced by
Constructors do not have meaningful return values, anything that is returned from here is discarded. Are you sure this is correct?
Loading history...
31
        }
32
        if (isset($attributes->Type)) {
33
            $this->setType($attributes->Type);
34
        }
35
        if (isset($attributes->BillShipper)) {
36
            $this->setBillShipper(new BillShipper($attributes->BillShipper));
37
        }
38
    }
39
40
    /**
41
     * @param null|DOMDocument $document
42
     *
43
     * @return DOMElement
44
     */
45
    public function toNode(DOMDocument $document = null)
46
    {
47
        if (is_null($document)) {
48
            $document = new DOMDocument();
49
        }
50
51
        $node = $document->createElement('ShipmentCharge');
52
53
        if ($this->getType()) {
54
            $node->appendChild($document->createElement('Type', $this->getType()));
55
        }
56
        if ($this->getBillShipper()) {
57
            $node->appendChild($this->getBillShipper()->toNode($document));
58
        }
59
60
        return $node;
61
    }
62
63
    /**
64
     * @return string
65
     */
66
    public function getType()
67
    {
68
        return $this->type;
69
    }
70
71
    /**
72
     * @param string $type
73
     *
74
     * @return ShipmentCharge
75
     */
76
    public function setType($type)
77
    {
78
        $this->type = $type;
79
80
        return $this;
81
    }
82
83
    /**
84
     * @return BillShipper
85
     */
86
    public function getBillShipper()
87
    {
88
        return $this->billShipper;
89
    }
90
91
    /**
92
     * @param BillShipper $billShipper
93
     *
94
     * return ShipmentCharge
95
     */
96
    public function setBillShipper($billShipper)
97
    {
98
        $this->billShipper = $billShipper;
99
100
        return $this;
101
    }
102
103
    /**
104
     * @return bool
105
     */
106
    public function getConsigneeBilled()
107
    {
108
        return $this->consigneeBilled;
109
    }
110
111
    /**
112
     * @param bool $consigneeBilled
113
     * @return PaymentInformation
114
     */
115
    public function setConsigneeBilled($consigneeBilled)
116
    {
117
        $this->consigneeBilled = $consigneeBilled;
118
119
        return $this;
120
    }
121
}
122