RequestData   A
last analyzed

Complexity

Total Complexity 14

Size/Duplication

Total Lines 215
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 27.78%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 14
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 215
ccs 10
cts 36
cp 0.2778
rs 10

13 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getSubscriptionId() 0 4 1
A setSubscriptionId() 0 6 1
A getArticleNumber() 0 4 1
A setArticleNumber() 0 6 1
A getQuantity() 0 4 1
A setQuantity() 0 9 2
A getTitle() 0 4 1
A setTitle() 0 6 1
A getDescription() 0 4 1
A setDescription() 0 6 1
A getUnitPrice() 0 4 1
A setUnitPrice() 0 6 1
1
<?php
2
3
namespace Speicher210\Fastbill\Api\Service\Subscription\SetAddon;
4
5
use JMS\Serializer\Annotation as JMS;
6
use Speicher210\Fastbill\Api\AbstractRequestData;
7
8
/**
9
 * The request data for setting addon for a subscription.
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
     * The article number.
25
     *
26
     * @var string
27
     *
28
     * @JMS\Type("string")
29
     * @JMS\SerializedName("ARTICLE_NUMBER")
30
     */
31
    protected $articleNumber;
32
33
    /**
34
     * Quantity.
35
     *
36
     * @var integer
37
     *
38
     * @JMS\Type("integer")
39
     * @JMS\SerializedName("QUANTITY")
40
     */
41
    protected $quantity;
42
43
    /**
44
     * The title of the addon.
45
     *
46
     * @var string
47
     *
48
     * @JMS\Type("string")
49
     * @JMS\SerializedName("TITLE")
50
     */
51
    protected $title;
52
53
    /**
54
     * The description of the addon.
55
     *
56
     * @var string
57
     *
58
     * @JMS\Type("string")
59
     * @JMS\SerializedName("DESCRIPTION")
60
     */
61
    protected $description;
62
63
    /**
64
     * The unit price.
65
     *
66
     * @var float
67
     *
68
     * @JMS\Type("float")
69
     * @JMS\SerializedName("UNIT_PRICE")
70
     */
71
    protected $unitPrice;
72
73
    /**
74
     * Constructor.
75
     *
76
     * @param string $subscriptionId The subscription ID.
77
     * @param string $articleNumber The article number.
78
     */
79 3
    public function __construct($subscriptionId, $articleNumber)
80
    {
81 3
        $this->setSubscriptionId($subscriptionId);
82 3
        $this->setArticleNumber($articleNumber);
83 3
    }
84
85
    /**
86
     * Get the subscription ID.
87
     *
88
     * @return integer
89
     */
90
    public function getSubscriptionId()
91
    {
92
        return $this->subscriptionId;
93
    }
94
95
    /**
96
     * Set the subscription ID.
97
     *
98
     * @param integer $subscriptionId The subscription ID.
99
     * @return RequestData
100
     */
101 3
    public function setSubscriptionId($subscriptionId)
102
    {
103 3
        $this->subscriptionId = $subscriptionId;
104
105 3
        return $this;
106
    }
107
108
    /**
109
     * Get the article number.
110
     *
111
     * @return integer
112
     */
113
    public function getArticleNumber()
114
    {
115
        return $this->articleNumber;
116
    }
117
118
    /**
119
     * Set the article number.
120
     *
121
     * @param string $articleNumber The article number.
122
     * @return RequestData
123
     */
124 3
    public function setArticleNumber($articleNumber)
125
    {
126 3
        $this->articleNumber = $articleNumber;
127
128 3
        return $this;
129
    }
130
131
    /**
132
     * Get the quantity.
133
     *
134
     * @return integer
135
     */
136
    public function getQuantity()
137
    {
138
        return $this->quantity;
139
    }
140
141
    /**
142
     * Set the quantity.
143
     *
144
     * @param integer $quantity The quantity.
145
     * @return RequestData
146
     */
147
    public function setQuantity($quantity)
148
    {
149
        if ($quantity < 1) {
150
            throw new \InvalidArgumentException('Quantity must be bigger than 0.');
151
        }
152
        $this->quantity = $quantity;
153
154
        return $this;
155
    }
156
157
    /**
158
     * Get the title.
159
     *
160
     * @return string
161
     */
162
    public function getTitle()
163
    {
164
        return $this->title;
165
    }
166
167
    /**
168
     * Set the title.
169
     *
170
     * @param string $title The title.
171
     * @return RequestData
172
     */
173
    public function setTitle($title)
174
    {
175
        $this->title = $title;
176
177
        return $this;
178
    }
179
180
    /**
181
     * Get the description.
182
     *
183
     * @return string
184
     */
185
    public function getDescription()
186
    {
187
        return $this->description;
188
    }
189
190
    /**
191
     * Set the description.
192
     *
193
     * @param string $description The description.
194
     * @return RequestData
195
     */
196
    public function setDescription($description)
197
    {
198
        $this->description = $description;
199
200
        return $this;
201
    }
202
203
    /**
204
     * Get the unit price.
205
     *
206
     * @return float
207
     */
208
    public function getUnitPrice()
209
    {
210
        return $this->unitPrice;
211
    }
212
213
    /**
214
     * Set the unit price.
215
     *
216
     * @param float $unitPrice The price.
217
     * @return RequestData
218
     */
219
    public function setUnitPrice($unitPrice)
220
    {
221
        $this->unitPrice = $unitPrice;
222
223
        return $this;
224
    }
225
}
226