RequestData   A
last analyzed

Complexity

Total Complexity 16

Size/Duplication

Total Lines 248
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 24.39%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 16
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 248
ccs 10
cts 41
cp 0.2439
rs 10

15 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 getUnitPrice() 0 4 1
A setUnitPrice() 0 6 1
A getDescription() 0 4 1
A setDescription() 0 6 1
A getCurrencyCode() 0 4 1
A setCurrencyCode() 0 6 1
A getUsageDate() 0 4 1
A setUsageDate() 0 6 1
1
<?php
2
3
namespace Speicher210\Fastbill\Api\Service\Subscription\SetUsageData;
4
5
use JMS\Serializer\Annotation as JMS;
6
use Speicher210\Fastbill\Api\AbstractRequestData;
7
8
/**
9
 * The request data for setting usage data 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 unit price.
45
     *
46
     * @var float
47
     *
48
     * @JMS\Type("float")
49
     * @JMS\SerializedName("UNIT_PRICE")
50
     */
51
    protected $unitPrice;
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 usage date.
65
     *
66
     * @var string
67
     *
68
     * @JMS\Type("string")
69
     * @JMS\SerializedName("USAGE_DATE")
70
     */
71
    protected $usageDate;
72
73
    /**
74
     * The currency code.
75
     *
76
     * @var string
77
     *
78
     * @JMS\Type("string")
79
     * @JMS\SerializedName("CURRENCY_CODE")
80
     */
81
    protected $currencyCode;
82
83
    /**
84
     * Constructor.
85
     *
86
     * @param integer $subscriptionId The subscription ID.
87
     * @param string $articleNumber The article number.
88
     */
89 3
    public function __construct($subscriptionId, $articleNumber)
90
    {
91 3
        $this->setSubscriptionId($subscriptionId);
92 3
        $this->setArticleNumber($articleNumber);
93 3
    }
94
95
    /**
96
     * Get the subscription ID.
97
     *
98
     * @return integer
99
     */
100
    public function getSubscriptionId()
101
    {
102
        return $this->subscriptionId;
103
    }
104
105
    /**
106
     * Set the subscription ID.
107
     *
108
     * @param integer $subscriptionId The subscription ID.
109
     * @return RequestData
110
     */
111 3
    public function setSubscriptionId($subscriptionId)
112
    {
113 3
        $this->subscriptionId = $subscriptionId;
114
115 3
        return $this;
116
    }
117
118
    /**
119
     * Get the article number.
120
     *
121
     * @return integer
122
     */
123
    public function getArticleNumber()
124
    {
125
        return $this->articleNumber;
126
    }
127
128
    /**
129
     * Set the article number.
130
     *
131
     * @param string $articleNumber The article number.
132
     * @return RequestData
133
     */
134 3
    public function setArticleNumber($articleNumber)
135
    {
136 3
        $this->articleNumber = $articleNumber;
137
138 3
        return $this;
139
    }
140
141
    /**
142
     * Get the quantity.
143
     *
144
     * @return integer
145
     */
146
    public function getQuantity()
147
    {
148
        return $this->quantity;
149
    }
150
151
    /**
152
     * Set the quantity.
153
     *
154
     * @param integer $quantity The quantity.
155
     * @return RequestData
156
     */
157
    public function setQuantity($quantity)
158
    {
159
        if ($quantity < 1) {
160
            throw new \InvalidArgumentException('Quantity must be bigger than 0.');
161
        }
162
        $this->quantity = $quantity;
163
164
        return $this;
165
    }
166
167
    /**
168
     * Get the unit price.
169
     *
170
     * @return float
171
     */
172
    public function getUnitPrice()
173
    {
174
        return $this->unitPrice;
175
    }
176
177
    /**
178
     * Set the unit price.
179
     *
180
     * @param float $unitPrice The price.
181
     * @return RequestData
182
     */
183
    public function setUnitPrice($unitPrice)
184
    {
185
        $this->unitPrice = $unitPrice;
186
187
        return $this;
188
    }
189
190
    /**
191
     * Get the description.
192
     *
193
     * @return string
194
     */
195
    public function getDescription()
196
    {
197
        return $this->description;
198
    }
199
200
    /**
201
     * Set the description.
202
     *
203
     * @param string $description The description.
204
     * @return RequestData
205
     */
206
    public function setDescription($description)
207
    {
208
        $this->description = $description;
209
210
        return $this;
211
    }
212
213
    /**
214
     * Get the currency code.
215
     *
216
     * @return string
217
     */
218
    public function getCurrencyCode()
219
    {
220
        return $this->currencyCode;
221
    }
222
223
    /**
224
     * Set the currency code.
225
     *
226
     * @param string $currencyCode The currency code.
227
     * @return RequestData
228
     */
229
    public function setCurrencyCode($currencyCode)
230
    {
231
        $this->currencyCode = $currencyCode;
232
233
        return $this;
234
    }
235
236
    /**
237
     * Get the usage date.
238
     *
239
     * @return string
240
     */
241
    public function getUsageDate()
242
    {
243
        return $this->usageDate;
244
    }
245
246
    /**
247
     * Set the usage date.
248
     *
249
     * @param string $usageDate The usage date.
250
     * @return RequestData
251
     */
252
    public function setUsageDate($usageDate)
253
    {
254
        $this->usageDate = $usageDate;
255
256
        return $this;
257
    }
258
}
259