RegionalInformation::withReversedVat()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Billogram\Model\Invoice;
6
7
use Billogram\Model\CreatableFromArray;
8
9
/**
10
 * @author Ibrahim Hizeoui <[email protected]>
11
 */
12
class RegionalInformation implements CreatableFromArray
13
{
14
    /**
15
     * @var int
16
     */
17
    private $rotavdrag = 0;
18
19
    /**
20
     * @var string
21
     */
22
    private $rotavdragPersonalNumber;
23
24
    /**
25
     * @var string
26
     */
27
    private $rotavdragDescription;
28
29
    /**
30
     * @var bool
31
     */
32
    private $reversedVat = false;
33
34
    /**
35
     * @var string
36
     */
37
    private $autogiroBetalarnummer;
38
39
    /**
40
     * @var string
41
     */
42
    private $autogiroPaymentDate;
43
44
    /**
45
     * @var string
46
     */
47
    private $autogiroStatus;
48
49
    /**
50
     * @var string
51
     */
52
    private $autogiroFullStatus;
53
54
    /**
55
     * @var string
56
     */
57
    private $autogiroTotalSum;
58
59
    /**
60
     * @var string
61
     */
62
    private $efakturaRecipientIdentifier;
63
64
    /**
65
     * @var string
66
     */
67
    private $efakturaRecipientType;
68
69
    /**
70
     * @var string
71
     */
72
    private $efakturaRecipientBankName;
73
74
    /**
75
     * @var int
76
     */
77
    private $efakturaRecipientBankId;
78
79
    /**
80
     * @var string
81
     */
82
    private $efakturaRecipientBankCode;
83
84
    /**
85
     * @var int
86
     */
87
    private $efakturaRecipientIdNumber;
88
89
    /**
90
     * @var int
91
     */
92
    private $efakturaRequestedAmount;
93
94
    /**
95
     * @var CollectionForElectricityInvoices
96
     */
97
    private $collectionForElectricityInvoices;
98
99
    /**
100
     * @return int
101
     */
102
    public function getRotavdrag(): int
103
    {
104
        return $this->rotavdrag;
105
    }
106
107
    /**
108
     * @param int $rotavdrag
109
     *
110
     * @return RegionalInformation
111
     */
112
    public function withRotavdrag(int $rotavdrag)
113
    {
114
        $new = clone $this;
115
        $new->rotavdrag = $rotavdrag;
116
117
        return $new;
118
    }
119
120
    /**
121
     * @return string
122
     */
123
    public function getRotavdragPersonalNumber(): string
124
    {
125
        return $this->rotavdragPersonalNumber;
126
    }
127
128
    /**
129
     * @param string $rotavdragPersonalNumber
130
     *
131
     * @return RegionalInformation
132
     */
133
    public function withRotavdragPersonalNumber(string $rotavdragPersonalNumber)
134
    {
135
        $new = clone $this;
136
        $new->rotavdragPersonalNumber = $rotavdragPersonalNumber;
137
138
        return $new;
139
    }
140
141
    /**
142
     * @return string
143
     */
144
    public function getRotavdragDescription(): string
145
    {
146
        return $this->rotavdragDescription;
147
    }
148
149
    /**
150
     * @param string $rotavdragDescription
151
     *
152
     * @return RegionalInformation
153
     */
154
    public function withRotavdragDescription(string $rotavdragDescription)
155
    {
156
        $new = clone $this;
157
        $new->rotavdragDescription = $rotavdragDescription;
158
159
        return $new;
160
    }
161
162
    /**
163
     * @return bool
164
     */
165
    public function isReversedVat(): bool
166
    {
167
        return $this->reversedVat;
168
    }
169
170
    /**
171
     * @param bool $reversedVat
172
     *
173
     * @return RegionalInformation
174
     */
175
    public function withReversedVat(bool $reversedVat)
176
    {
177
        $new = clone $this;
178
        $new->reversedVat = $reversedVat;
179
180
        return $new;
181
    }
182
183
    /**
184
     * @return string
185
     */
186
    public function getAutogiroBetalarnummer(): string
187
    {
188
        return $this->autogiroBetalarnummer;
189
    }
190
191
    /**
192
     * @param string $autogiroBetalarnummer
193
     *
194
     * @return RegionalInformation
195
     */
196
    public function withAutogiroBetalarnummer(string $autogiroBetalarnummer)
197
    {
198
        $new = clone $this;
199
        $new->autogiroBetalarnummer = $autogiroBetalarnummer;
200
201
        return $new;
202
    }
203
204
    /**
205
     * @return string
206
     */
207
    public function getAutogiroPaymentDate(): string
208
    {
209
        return $this->autogiroPaymentDate;
210
    }
211
212
    /**
213
     * @param string $autogiroPaymentDate
214
     *
215
     * @return RegionalInformation
216
     */
217
    public function withAutogiroPaymentDate(string $autogiroPaymentDate)
218
    {
219
        $new = clone $this;
220
        $new->autogiroPaymentDate = $autogiroPaymentDate;
221
222
        return $new;
223
    }
224
225
    /**
226
     * @return string
227
     */
228
    public function getAutogiroStatus(): string
229
    {
230
        return $this->autogiroStatus;
231
    }
232
233
    /**
234
     * @param string $autogiroStatus
235
     *
236
     * @return RegionalInformation
237
     */
238
    public function withAutogiroStatus(string $autogiroStatus)
239
    {
240
        $new = clone $this;
241
        $new->autogiroStatus = $autogiroStatus;
242
243
        return $new;
244
    }
245
246
    /**
247
     * @return string
248
     */
249
    public function getAutogiroFullStatus(): string
250
    {
251
        return $this->autogiroFullStatus;
252
    }
253
254
    /**
255
     * @param string $autogiroFullStatus
256
     *
257
     * @return RegionalInformation
258
     */
259
    public function withAutogiroFullStatus(string $autogiroFullStatus)
260
    {
261
        $new = clone $this;
262
        $new->autogiroFullStatus = $autogiroFullStatus;
263
264
        return $new;
265
    }
266
267
    /**
268
     * @return string
269
     */
270
    public function getAutogiroTotalSum(): string
271
    {
272
        return $this->autogiroTotalSum;
273
    }
274
275
    /**
276
     * @param string $autogiroTotalSum
277
     *
278
     * @return RegionalInformation
279
     */
280
    public function withAutogiroTotalSum(string $autogiroTotalSum)
281
    {
282
        $new = clone $this;
283
        $new->autogiroTotalSum = $autogiroTotalSum;
284
285
        return $new;
286
    }
287
288
    /**
289
     * @return string
290
     */
291
    public function getEfakturaRecipientIdentifier(): string
292
    {
293
        return $this->efakturaRecipientIdentifier;
294
    }
295
296
    /**
297
     * @param string $efakturaRecipientIdentifier
298
     *
299
     * @return RegionalInformation
300
     */
301
    public function withEfakturaRecipientIdentifier(string $efakturaRecipientIdentifier)
302
    {
303
        $new = clone $this;
304
        $new->efakturaRecipientIdentifier = $efakturaRecipientIdentifier;
305
306
        return $new;
307
    }
308
309
    /**
310
     * @return string
311
     */
312
    public function getEfakturaRecipientType(): string
313
    {
314
        return $this->efakturaRecipientType;
315
    }
316
317
    /**
318
     * @param string $efakturaRecipientType
319
     *
320
     * @return RegionalInformation
321
     */
322
    public function withEfakturaRecipientType(string $efakturaRecipientType)
323
    {
324
        $new = clone $this;
325
        $new->efakturaRecipientType = $efakturaRecipientType;
326
327
        return $new;
328
    }
329
330
    /**
331
     * @return string
332
     */
333
    public function getEfakturaRecipientBankName(): string
334
    {
335
        return $this->efakturaRecipientBankName;
336
    }
337
338
    /**
339
     * @param string $efakturaRecipientBankName
340
     *
341
     * @return RegionalInformation
342
     */
343
    public function withEfakturaRecipientBankName(string $efakturaRecipientBankName)
344
    {
345
        $new = clone $this;
346
        $new->efakturaRecipientBankName = $efakturaRecipientBankName;
347
348
        return $new;
349
    }
350
351
    /**
352
     * @return int
353
     */
354
    public function getEfakturaRecipientBankId(): int
355
    {
356
        return $this->efakturaRecipientBankId;
357
    }
358
359
    /**
360
     * @param int $efakturaRecipientBankId
361
     *
362
     * @return RegionalInformation
363
     */
364
    public function withEfakturaRecipientBankId(int $efakturaRecipientBankId)
365
    {
366
        $new = clone $this;
367
        $new->efakturaRecipientBankId = $efakturaRecipientBankId;
368
369
        return $new;
370
    }
371
372
    /**
373
     * @return string
374
     */
375
    public function getEfakturaRecipientBankCode(): string
376
    {
377
        return $this->efakturaRecipientBankCode;
378
    }
379
380
    /**
381
     * @param string $efakturaRecipientBankCode
382
     *
383
     * @return RegionalInformation
384
     */
385
    public function withEfakturaRecipientBankCode(string $efakturaRecipientBankCode)
386
    {
387
        $new = clone $this;
388
        $new->efakturaRecipientBankCode = $efakturaRecipientBankCode;
389
390
        return $new;
391
    }
392
393
    /**
394
     * @return int
395
     */
396
    public function getEfakturaRecipientIdNumber(): int
397
    {
398
        return $this->efakturaRecipientIdNumber;
399
    }
400
401
    /**
402
     * @param int $efakturaRecipientIdNumber
403
     *
404
     * @return RegionalInformation
405
     */
406
    public function withEfakturaRecipientIdNumber(int $efakturaRecipientIdNumber)
407
    {
408
        $new = clone $this;
409
        $new->efakturaRecipientIdNumber = $efakturaRecipientIdNumber;
410
411
        return $new;
412
    }
413
414
    /**
415
     * @return int
416
     */
417
    public function getEfakturaRequestedAmount(): int
418
    {
419
        return $this->efakturaRequestedAmount;
420
    }
421
422
    /**
423
     * @param int $efakturaRequestedAmount
424
     *
425
     * @return RegionalInformation
426
     */
427
    public function withEfakturaRequestedAmount(int $efakturaRequestedAmount)
428
    {
429
        $new = clone $this;
430
        $new->efakturaRequestedAmount = $efakturaRequestedAmount;
431
432
        return $new;
433
    }
434
435
    /**
436
     * @return CollectionForElectricityInvoices
437
     */
438
    public function getCollectionForElectricityInvoices(): CollectionForElectricityInvoices
439
    {
440
        return $this->collectionForElectricityInvoices;
441
    }
442
443
    /**
444
     * @param CollectionForElectricityInvoices $collectionForElectricityInvoices
445
     *
446
     * @return RegionalInformation
447
     */
448
    public function withCollectionForElectricityInvoices(CollectionForElectricityInvoices $collectionForElectricityInvoices)
449
    {
450
        $new = clone $this;
451
        $new->collectionForElectricityInvoices = $collectionForElectricityInvoices;
452
453
        return $new;
454
    }
455
456
    public function toArray()
457
    {
458
        $data = [];
459
        if (null !== $this->rotavdrag) {
460
            $data['rotavdrag'] = $this->rotavdrag;
461
        }
462
        if (null !== $this->rotavdragPersonalNumber) {
463
            $data['rotavdrag_personal_number'] = $this->rotavdragPersonalNumber;
464
        }
465
        if (null !== $this->rotavdragDescription) {
466
            $data['rotavdrag_description'] = $this->rotavdragDescription;
467
        }
468
        if (null !== $this->reversedVat) {
469
            $data['reversed_vat'] = $this->reversedVat;
470
        }
471
        if (null !== $this->autogiroBetalarnummer) {
472
            $data['autogiro_betalarnummer'] = $this->autogiroBetalarnummer;
473
        }
474
        if (null !== $this->autogiroPaymentDate) {
475
            $data['autogiro_payment_date'] = $this->autogiroPaymentDate;
476
        }
477
        if (null !== $this->autogiroStatus) {
478
            $data['autogiro_status'] = $this->autogiroStatus;
479
        }
480
        if (null !== $this->autogiroFullStatus) {
481
            $data['autogiro_full_status'] = $this->autogiroFullStatus;
482
        }
483
        if (null !== $this->autogiroTotalSum) {
484
            $data['autogiro_total_sum'] = $this->autogiroTotalSum;
485
        }
486
        if (null !== $this->efakturaRecipientIdentifier) {
487
            $data['efaktura_recipient_identifier'] = $this->efakturaRecipientIdentifier;
488
        }
489
        if (null !== $this->efakturaRecipientType) {
490
            $data['efaktura_recipient_type'] = $this->efakturaRecipientType;
491
        }
492
        if (null !== $this->efakturaRecipientBankName) {
493
            $data['efaktura_recipient_bank_name'] = $this->efakturaRecipientBankName;
494
        }
495
        if (null !== $this->efakturaRecipientBankId) {
496
            $data['efaktura_recipient_bank_id'] = $this->efakturaRecipientBankId;
497
        }
498
        if (null !== $this->efakturaRecipientBankCode) {
499
            $data['efaktura_recipient_bank_code'] = $this->efakturaRecipientBankCode;
500
        }
501
        if (null !== $this->efakturaRecipientIdNumber) {
502
            $data['efaktura_recipient_id_number'] = $this->efakturaRecipientIdNumber;
503
        }
504
        if (null !== $this->efakturaRequestedAmount) {
505
            $data['efaktura_requested_amount'] = $this->efakturaRequestedAmount;
506
        }
507
        if (null !== $this->collectionForElectricityInvoices) {
508
            $data['efaktura_recipient_bank_code'] = $this->collectionForElectricityInvoices->toArray();
509
        }
510
511
        return $data;
512
    }
513
514
    /**
515
     * Create an API response object from the HTTP response from the API server.
516
     *
517
     * @param array $data
518
     *
519
     * @return self
520
     */
521 3
    public static function createFromArray(array $data)
522
    {
523 3
        $regionalInfo = new self();
524 3
        $regionalInfo->rotavdrag = $data['rotavdrag'] ?? null;
525 3
        $regionalInfo->rotavdragPersonalNumber = $data['rotavdrag_personal_number'] ?? null;
526 3
        $regionalInfo->rotavdragDescription = $data['rotavdrag_description'] ?? null;
527 3
        $regionalInfo->reversedVat = $data['reversed_vat'] ?? null;
528 3
        $regionalInfo->autogiroBetalarnummer = $data['autogiro_betalarnummer'] ?? null;
529 3
        $regionalInfo->autogiroPaymentDate = $data['autogiro_payment_date'] ?? null;
530 3
        $regionalInfo->autogiroStatus = $data['autogiro_status'] ?? null;
531 3
        $regionalInfo->autogiroFullStatus = $data['autogiro_full_status'] ?? null;
532 3
        $regionalInfo->autogiroTotalSum = $data['autogiro_total_sum'] ?? null;
533 3
        $regionalInfo->efakturaRecipientType = $data['efaktura_recipient_type'] ?? null;
534 3
        $regionalInfo->efakturaRecipientIdentifier = $data['efaktura_recipient_identifier'] ?? null;
535 3
        $regionalInfo->efakturaRecipientBankName = $data['efaktura_recipient_bank_name'] ?? null;
536 3
        $regionalInfo->efakturaRecipientBankId = $data['efaktura_recipient_bank_id'] ?? null;
537 3
        $regionalInfo->efakturaRecipientBankCode = $data['efaktura_recipient_bank_code'] ?? null;
538 3
        $regionalInfo->rotavdragPersonalNumber = $data['efaktura_recipient_id_number'] ?? null;
539 3
        $regionalInfo->efakturaRequestedAmount = $data['efaktura_requested_amount'] ?? null;
540 3
        $regionalInfo->collectionForElectricityInvoices = CollectionForElectricityInvoices::createFromArray($data['electricity_collection']);
541
542 3
        return $regionalInfo;
543
    }
544
}
545