Completed
Push — master ( a5ec3b...638ed1 )
by Jan
05:09 queued 02:55
created

Receipt::__construct()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 41
Code Lines 38

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 21
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 41
ccs 21
cts 21
cp 1
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 38
nc 1
nop 18
crap 1

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php declare(strict_types = 1);
2
3
namespace SlevomatEET;
4
5
class Receipt
6
{
7
8
	/**
9
	 * XML uuid_zpravy
10
	 *
11
	 * @var \Ramsey\Uuid\UuidInterface
12
	 */
13
	private $uuid;
14
15
	/**
16
	 * XML prvni_zaslani
17
	 *
18
	 * @var bool
19
	 */
20
	private $firstSend = true;
21
22
	/**
23
	 * XML dic_poverujiciho
24
	 *
25
	 * @var string|null
26
	 */
27
	private $delegatedVatId;
28
29
	/**
30
	 * XML porad_cis
31
	 *
32
	 * @var string
33
	 */
34
	private $receiptNumber;
35
36
	/**
37
	 * XML dat_trzby
38
	 *
39
	 * @var \DateTimeImmutable
40
	 */
41
	private $receiptTime;
42
43
	/**
44
	 * XML celk_trzba
45
	 *
46
	 * @var int
47
	 */
48
	private $totalPrice;
49
50
	/**
51
	 * XML zakl_nepodl_dph
52
	 *
53
	 * @var int|null
54
	 */
55
	private $priceZeroVat;
56
57
	/**
58
	 * XML zakl_dan1
59
	 *
60
	 * @var int|null
61
	 */
62
	private $priceStandardVat;
63
64
	/**
65
	 * XML dan1
66
	 *
67
	 * @var int|null
68
	 */
69
	private $vatStandard;
70
71
	/**
72
	 * XML zakl_dan2
73
	 *
74
	 * @var int|null
75
	 */
76
	private $priceFirstReducedVat;
77
78
	/**
79
	 * XML dan2
80
	 *
81
	 * @var int|null
82
	 */
83
	private $vatFirstReduced;
84
85
	/**
86
	 * XML zakl_dan3
87
	 *
88
	 * @var int|null
89
	 */
90
	private $priceSecondReducedVat;
91
92
	/**
93
	 * XML dan3
94
	 *
95
	 * @var int|null
96
	 */
97
	private $vatSecondReduced;
98
99
	/**
100
	 * XML cest_sluz
101
	 *
102
	 * @var int|null
103
	 */
104
	private $priceTravelService;
105
106
	/**
107
	 * XML pouzit_zboz1
108
	 *
109
	 * @var int|null
110
	 */
111
	private $priceUsedGoodsStandardVat;
112
113
	/**
114
	 * XML pouzit_zboz2
115
	 *
116
	 * @var int|null
117
	 */
118
	private $priceUsedGoodsFirstReducedVat;
119
120
	/**
121
	 * XML pouzit_zboz3
122
	 *
123
	 * @var int|null
124
	 */
125
	private $priceUsedGoodsSecondReducedVat;
126
127
	/**
128
	 * XML urceno_cerp_zuct
129
	 *
130
	 * @var int|null
131
	 */
132
	private $priceForSubsequentSettlement;
133
134
	/**
135
	 * XML cerp_zuct
136
	 *
137
	 * @var int|null
138
	 */
139
	private $priceUsedSubsequentSettlement;
140
141 4
	public function __construct(
142
		bool $firstSend,
143
		string $delegatedVatId = null,
144
		string $receiptNumber,
145
		\DateTimeImmutable $receiptTime,
146
		int $totalPrice = 0,
147
		int $priceZeroVat = null,
148
		int $priceStandardVat = null,
149
		int $vatStandard = null,
150
		int $priceFirstReducedVat = null,
151
		int $vatFirstReduced = null,
152
		int $priceSecondReducedVat = null,
153
		int $vatSecondReduced = null,
154
		int $priceTravelService = null,
155
		int $priceUsedGoodsStandardVat = null,
156
		int $priceUsedGoodsFirstReducedVat = null,
157
		int $priceUsedGoodsSecondReducedVat = null,
158
		int $priceSubsequentSettlement = null,
159
		int $priceUsedSubsequentSettlement = null
160
	)
161
	{
162 4
		$this->uuid = \Ramsey\Uuid\Uuid::uuid4();
163 4
		$this->firstSend = $firstSend;
164 4
		$this->delegatedVatId = $delegatedVatId;
165 4
		$this->receiptNumber = $receiptNumber;
166 4
		$this->receiptTime = $receiptTime;
167 4
		$this->totalPrice = $totalPrice;
168 4
		$this->priceZeroVat = $priceZeroVat;
169 4
		$this->priceStandardVat = $priceStandardVat;
170 4
		$this->vatStandard = $vatStandard;
171 4
		$this->priceFirstReducedVat = $priceFirstReducedVat;
172 4
		$this->vatFirstReduced = $vatFirstReduced;
173 4
		$this->priceSecondReducedVat = $priceSecondReducedVat;
174 4
		$this->vatSecondReduced = $vatSecondReduced;
175 4
		$this->priceTravelService = $priceTravelService;
176 4
		$this->priceUsedGoodsStandardVat = $priceUsedGoodsStandardVat;
177 4
		$this->priceUsedGoodsFirstReducedVat = $priceUsedGoodsFirstReducedVat;
178 4
		$this->priceUsedGoodsSecondReducedVat = $priceUsedGoodsSecondReducedVat;
179 4
		$this->priceForSubsequentSettlement = $priceSubsequentSettlement;
180 4
		$this->priceUsedSubsequentSettlement = $priceUsedSubsequentSettlement;
181 4
	}
182
183 4
	public function getUuid(): \Ramsey\Uuid\UuidInterface
184
	{
185 4
		return $this->uuid;
186
	}
187
188 4
	public function isFirstSend(): bool
189
	{
190 4
		return $this->firstSend;
191
	}
192
193
	/**
194
	 * @return null|string
195
	 */
196 4
	public function getDelegatedVatId()
197
	{
198 4
		return $this->delegatedVatId;
199
	}
200
201 4
	public function getReceiptNumber(): string
202
	{
203 4
		return $this->receiptNumber;
204
	}
205
206 4
	public function getReceiptTime(): \DateTimeImmutable
207
	{
208 4
		return $this->receiptTime;
209
	}
210
211 4
	public function getTotalPrice(): int
212
	{
213 4
		return $this->totalPrice;
214
	}
215
216
	/**
217
	 * @return int|null
218
	 */
219 4
	public function getPriceZeroVat()
220
	{
221 4
		return $this->priceZeroVat;
222
	}
223
224
	/**
225
	 * @return int|null
226
	 */
227 4
	public function getPriceStandardVat()
228
	{
229 4
		return $this->priceStandardVat;
230
	}
231
232
	/**
233
	 * @return int|null
234
	 */
235 4
	public function getVatStandard()
236
	{
237 4
		return $this->vatStandard;
238
	}
239
240
	/**
241
	 * @return int|null
242
	 */
243 4
	public function getPriceFirstReducedVat()
244
	{
245 4
		return $this->priceFirstReducedVat;
246
	}
247
248
	/**
249
	 * @return int|null
250
	 */
251 4
	public function getVatFirstReduced()
252
	{
253 4
		return $this->vatFirstReduced;
254
	}
255
256
	/**
257
	 * @return int|null
258
	 */
259 4
	public function getPriceSecondReducedVat()
260
	{
261 4
		return $this->priceSecondReducedVat;
262
	}
263
264
	/**
265
	 * @return int|null
266
	 */
267 4
	public function getVatSecondReduced()
268
	{
269 4
		return $this->vatSecondReduced;
270
	}
271
272
	/**
273
	 * @return int|null
274
	 */
275 4
	public function getPriceTravelService()
276
	{
277 4
		return $this->priceTravelService;
278
	}
279
280
	/**
281
	 * @return int|null
282
	 */
283 4
	public function getPriceUsedGoodsStandardVat()
284
	{
285 4
		return $this->priceUsedGoodsStandardVat;
286
	}
287
288
	/**
289
	 * @return int|null
290
	 */
291 4
	public function getPriceUsedGoodsFirstReducedVat()
292
	{
293 4
		return $this->priceUsedGoodsFirstReducedVat;
294
	}
295
296
	/**
297
	 * @return int|null
298
	 */
299 4
	public function getPriceUsedGoodsSecondReducedVat()
300
	{
301 4
		return $this->priceUsedGoodsSecondReducedVat;
302
	}
303
304
	/**
305
	 * @return int|null
306
	 */
307 4
	public function getPriceForSubsequentSettlement()
308
	{
309 4
		return $this->priceForSubsequentSettlement;
310
	}
311
312
	/**
313
	 * @return int|null
314
	 */
315 4
	public function getPriceUsedSubsequentSettlement()
316
	{
317 4
		return $this->priceUsedSubsequentSettlement;
318
	}
319
320
}
321