RequestData::getSubscriptionId()   A
last analyzed

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 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Speicher210\Fastbill\Api\Service\Subscription\Postpone;
4
5
use JMS\Serializer\Annotation as JMS;
6
use Speicher210\Fastbill\Api\AbstractRequestData;
7
8
/**
9
 * The request for getting the upcoming amount.
10
 */
11
final class RequestData extends AbstractRequestData
12
{
13
    /**
14
     * The subscription ID.
15
     *
16
     * @var integer
17
     *
18
     * @JMS\Type("integer")
19
     * @JMS\SerializedName("SUBSCRIPTION_ID")
20
     */
21
    protected $subscriptionId;
22
23
    /**
24
     * @var string
25
     *
26
     * @JMS\Type("string")
27
     * @JMS\SerializedName("MONTH")
28
     */
29
    protected $month;
30
31
    /**
32
     * Constructor.
33
     *
34
     * @param integer $subscriptionId The subscription ID.
35
     * @param integer $month The month to postpone.
36
     */
37 3
    public function __construct($subscriptionId, $month)
38
    {
39 3
        $this->setSubscriptionId($subscriptionId);
40 3
        $this->setMonth($month);
41 3
    }
42
43
    /**
44
     * Get the subscription ID.
45
     *
46
     * @return integer
47
     */
48
    public function getSubscriptionId()
49
    {
50
        return $this->subscriptionId;
51
    }
52
53
    /**
54
     * Set the subscription ID.
55
     *
56
     * @param integer $subscriptionId The subscription ID.
57
     */
58 3
    public function setSubscriptionId($subscriptionId)
59
    {
60 3
        $this->subscriptionId = $subscriptionId;
61 3
    }
62
63
    /**
64
     * Get the month.
65
     *
66
     * @return integer
67
     */
68
    public function getMonth()
69
    {
70
        return (int) ltrim($this->month, '0');
71
    }
72
73
    /**
74
     * Set the month.
75
     *
76
     * @param integer $month The month for postponing.
77
     * @return RequestData
78
     */
79 3
    public function setMonth($month)
80
    {
81 3
        $this->month = str_pad($month, 2, '0', STR_PAD_LEFT);
82
83 3
        return $this;
84
    }
85
}
86