Charge::getItems()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
namespace PHPSC\PagSeguro\Purchases\Subscriptions;
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
9
/**
10
 * @Serializer\AccessType("public_method")
11
 * @Serializer\ReadOnly
12
 * @Serializer\XmlRoot("payment")
13
 *
14
 * @author Luís Otávio Cobucci Oblonczyk <[email protected]>
15
 */
16
class Charge
17
{
18
    use SerializerTrait;
19
20
    /**
21
     * @Serializer\SerializedName("preApprovalCode")
22
     * @Serializer\XmlElement(cdata=false)
23
     *
24
     * @var string
25
     */
26
    private $subscriptionCode;
27
28
    /**
29
     * @Serializer\Type("ArrayCollection<PHPSC\PagSeguro\Items\Item>")
30
     * @Serializer\XmlList(entry="item")
31
     * @Serializer\SerializedName("items")
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
     * @param ItemCollection $items
46
     */
47 5
    public function __construct(ItemCollection $items = null)
48
    {
49 5
        $this->items = $items ?: new Items();
50 5
    }
51
52
    /**
53
     * @return string
54
     */
55 2
    public function getSubscriptionCode()
56
    {
57 2
        return $this->subscriptionCode;
58
    }
59
60
    /**
61
     * @param string $subscriptionCode
62
     */
63 3
    public function setSubscriptionCode($subscriptionCode)
64
    {
65 3
        $this->subscriptionCode = $subscriptionCode;
66 3
    }
67
68
    /**
69
     * @return ItemCollection
70
     */
71 2
    public function getItems()
72
    {
73 2
        return $this->items;
74
    }
75
76
    /**
77
     * @return string
78
     */
79 2
    public function getReference()
80
    {
81 2
        return $this->reference;
82
    }
83
84
    /**
85
     * @param string $reference
86
     */
87 2
    public function setReference($reference)
88
    {
89 2
        $this->reference = $reference;
90 2
    }
91
}
92