RequestData   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 71.43%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 75
ccs 10
cts 14
cp 0.7143
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getSubscriptionId() 0 4 1
A setSubscriptionId() 0 4 1
A getMonth() 0 4 1
A setMonth() 0 6 1
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