Order   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 114
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 10
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 114
ccs 23
cts 23
cp 1
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A getCurrency() 0 4 1
A getItems() 0 4 1
A getReference() 0 4 1
A setReference() 0 4 1
A getShipping() 0 4 1
A setShipping() 0 4 1
A getExtraAmount() 0 4 1
A setExtraAmount() 0 4 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\Type("PHPSC\PagSeguro\Shipping\Shipping")
46
     *
47
     * @var Shipping
48
     */
49
    private $shipping;
50
51
    /**
52
     * @Serializer\XmlElement(cdata=false)
53
     *
54
     * @var float
55
     */
56
    private $extraAmount;
57
58
    /**
59
     * @param ItemCollection $items
60
     */
61 36
    public function __construct(ItemCollection $items = null)
62
    {
63 36
        $this->items    = $items ? : new Items();
64 36
        $this->currency = 'BRL';
65 36
    }
66
67
    /**
68
     * @return string
69
     */
70 5
    public function getCurrency()
71
    {
72 5
        return $this->currency;
73
    }
74
75
    /**
76
     * @return ItemCollection
77
     */
78 6
    public function getItems()
79
    {
80 6
        return $this->items;
81
    }
82
83
    /**
84
     * @return string
85
     */
86 5
    public function getReference()
87
    {
88 5
        return $this->reference;
89
    }
90
91
    /**
92
     * @param string $reference
93
     */
94 4
    public function setReference($reference)
95
    {
96 4
        $this->reference = $reference;
97 4
    }
98
99
    /**
100
     * @return Shipping
101
     */
102 5
    public function getShipping()
103
    {
104 5
        return $this->shipping;
105
    }
106
107
    /**
108
     * @param Shipping $shipping
109
     */
110 4
    public function setShipping(Shipping $shipping)
111
    {
112 4
        $this->shipping = $shipping;
113 4
    }
114
115
    /**
116
     * @return float
117
     */
118 5
    public function getExtraAmount()
119
    {
120 5
        return $this->formatAmount($this->extraAmount);
121
    }
122
123
    /**
124
     * @param float $extraAmount
125
     */
126 3
    public function setExtraAmount($extraAmount)
127
    {
128 3
        $this->extraAmount = $extraAmount;
129 3
    }
130
}
131