Passed
Pull Request — master (#63)
by
unknown
05:08
created

Order::setShippingAddressRequired()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
namespace PHPSC\PagSeguro\Requests\Checkout;
3
4
use JMS\Serializer\Annotation as Serializer;
5
use PHPSC\PagSeguro\Items\ItemCollection;
6
use PHPSC\PagSeguro\Items\Items;
7
use PHPSC\PagSeguro\SerializerTrait;
8
use PHPSC\PagSeguro\Shipping\Shipping;
9
10
/**
11
 * @Serializer\AccessType("public_method")
12
 * @Serializer\ReadOnly
13
 * @Serializer\XmlRoot("order")
14
 *
15
 * @author Luís Otávio Cobucci Oblonczyk <[email protected]>
16
 */
17
class Order
18
{
19
    use SerializerTrait;
20
21
    /**
22
     * @Serializer\XmlElement(cdata=false)
23
     *
24
     * @var string
25
     */
26
    private $currency;
27
28
    /**
29
     * @Serializer\SerializedName("items")
30
     * @Serializer\Type("ArrayCollection<PHPSC\PagSeguro\Items\Item>")
31
     * @Serializer\XmlList(entry="item")
32
     *
33
     * @var ItemCollection
34
     */
35
    private $items;
36
37
    /**
38
     * @Serializer\XmlElement(cdata=false)
39
     *
40
     * @var string
41
     */
42
    private $reference;
43
44
    /**
45
     * @Serializer\XmlElement(cdata=false)
46
     *
47
     * @var string
48
     */
49
    private $shippingAddressRequired;
50
51
    /**
52
     * @Serializer\Type("PHPSC\PagSeguro\Shipping\Shipping")
53
     *
54
     * @var Shipping
55
     */
56
    private $shipping;
57
58
    /**
59
     * @Serializer\XmlElement(cdata=false)
60
     *
61
     * @var float
62
     */
63
    private $extraAmount;
64
65
    /**
66
     * @param ItemCollection $items
67
     */
68 38
    public function __construct(ItemCollection $items = null)
69
    {
70 38
        $this->items    = $items ? : new Items();
71 38
        $this->currency = 'BRL';
72 38
    }
73
74
    /**
75
     * @return string
76
     */
77 5
    public function getCurrency()
78
    {
79 5
        return $this->currency;
80
    }
81
82
    /**
83
     * @return ItemCollection
84
     */
85 6
    public function getItems()
86
    {
87 6
        return $this->items;
88
    }
89
90
    /**
91
     * @return string
92
     */
93 5
    public function getReference()
94
    {
95 5
        return $this->reference;
96
    }
97
98
    /**
99
     * @param string $reference
100
     */
101 4
    public function setReference($reference)
102
    {
103 4
        $this->reference = $reference;
104 4
    }
105
106
    /**
107
     * @return string
108
     */
109 5
    public function getShippingAddressRequired()
110
    {
111 5
        return $this->shippingAddressRequired;
112
    }
113
114
    /**
115
     * @param string $shippingAddressRequired
116
     */
117 2
    public function setShippingAddressRequired($shippingAddressRequired)
118
    {
119 2
        $this->shippingAddressRequired = $shippingAddressRequired;
120 2
    }
121
122
    /**
123
     * @return Shipping
124
     */
125 5
    public function getShipping()
126
    {
127 5
        return $this->shipping;
128
    }
129
130
    /**
131
     * @param Shipping $shipping
132
     */
133 4
    public function setShipping(Shipping $shipping)
134
    {
135 4
        $this->shipping = $shipping;
136 4
    }
137
138
    /**
139
     * @return float
140
     */
141 5
    public function getExtraAmount()
142
    {
143 5
        return $this->formatAmount($this->extraAmount);
144
    }
145
146
    /**
147
     * @param float $extraAmount
148
     */
149 3
    public function setExtraAmount($extraAmount)
150
    {
151 3
        $this->extraAmount = $extraAmount;
152 3
    }
153
}
154