Item   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 118
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 118
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 1
A getId() 0 4 1
A getDescription() 0 4 1
A getAmount() 0 4 1
A getQuantity() 0 4 1
A getShippingCost() 0 4 1
A getWeight() 0 4 1
1
<?php
2
namespace PHPSC\PagSeguro\Items;
3
4
use JMS\Serializer\Annotation as Serializer;
5
use PHPSC\PagSeguro\SerializerTrait;
6
7
/**
8
 * @Serializer\AccessType("public_method")
9
 * @Serializer\ReadOnly
10
 * @Serializer\XmlRoot("item")
11
 *
12
 * @author Luís Otávio Cobucci Oblonczyk <[email protected]>
13
 */
14
class Item
15
{
16
    use SerializerTrait;
17
18
    /**
19
     * @Serializer\XmlElement(cdata=false)
20
     *
21
     * @var string
22
     */
23
    private $id;
24
25
    /**
26
     * @Serializer\XmlElement(cdata=false)
27
     *
28
     * @var string
29
     */
30
    private $description;
31
32
    /**
33
     * @Serializer\XmlElement(cdata=false)
34
     *
35
     * @var float
36
     */
37
    private $amount;
38
39
    /**
40
     * @Serializer\Type("integer")
41
     *
42
     * @var int
43
     */
44
    private $quantity;
45
46
    /**
47
     * @Serializer\XmlElement(cdata=false)
48
     *
49
     * @var float
50
     */
51
    private $shippingCost;
52
53
    /**
54
     * @Serializer\Type("integer")
55
     *
56
     * @var int
57
     */
58
    private $weight;
59
60
    /**
61
     * @param string $id
62
     * @param string $description
63
     * @param float $amount
64
     * @param int $quantity
65
     * @param float $shippingCost
66
     * @param int $weight
67
     */
68 8
    public function __construct(
69
        $id,
70
        $description,
71
        $amount,
72
        $quantity = 1,
73
        $shippingCost = null,
74
        $weight = null
75
    ) {
76 8
        $this->id = $id;
77 8
        $this->description = $description;
78 8
        $this->amount = $amount;
79 8
        $this->quantity = $quantity;
80 8
        $this->shippingCost = $shippingCost;
81 8
        $this->weight = $weight;
82 8
    }
83
84
    /**
85
     * @return string
86
     */
87 4
    public function getId()
88
    {
89 4
        return $this->id;
90
    }
91
92
    /**
93
     * @return string
94
     */
95 4
    public function getDescription()
96
    {
97 4
        return $this->description;
98
    }
99
100
    /**
101
     * @return string
102
     */
103 4
    public function getAmount()
104
    {
105 4
        return $this->formatAmount($this->amount);
106
    }
107
108
    /**
109
     * @return number
110
     */
111 4
    public function getQuantity()
112
    {
113 4
        return $this->quantity;
114
    }
115
116
    /**
117
     * @return string
118
     */
119 4
    public function getShippingCost()
120
    {
121 4
        return $this->formatAmount($this->shippingCost);
122
    }
123
124
    /**
125
     * @return number
126
     */
127 4
    public function getWeight()
128
    {
129 4
        return $this->weight;
130
    }
131
}
132