Completed
Push — master ( c13142...c0435c )
by Tobias
02:34
created

src/Model/Invoice/EventData.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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 EventData implements CreatableFromArray
13
{
14
    /**
15
     * @var string
16
     */
17
    private $invoiceNo;
18
19
    /**
20
     * @var string
21
     */
22
    private $deliveryMethod;
23
24
    /**
25
     * @var string
26
     */
27
    private $letterId;
28
29
    /**
30
     * @var int
31
     */
32
    private $amount;
33
34
    /**
35
     * @var string
36
     */
37
    private $payerName;
38
39
    /**
40
     * @var array
41
     */
42
    private $paymentFlags = [];
43
44
    /**
45
     * @var int
46
     */
47
    private $bankingAmount;
48
49
    /**
50
     * @var bool
51
     */
52
    private $manual;
53
54
    /**
55
     * @var int
56
     */
57
    private $reminderFee;
58
59
    /**
60
     * @var int
61
     */
62
    private $reminderCount;
63
64
    /**
65
     * @var int
66
     */
67
    private $interestRate;
68
69
    /**
70
     * @var string
71
     */
72
    private $customerEmail;
73
74
    /**
75
     * @var string
76
     */
77
    private $customerPhone;
78
79
    /**
80
     * @var string
81
     */
82
    private $ip;
83
84
    /**
85
     * @var string
86
     */
87
    private $type;
88
89
    /**
90
     * @var string[]
91
     */
92
    private $message;
93
94
    /**
95
     * @var string
96
     */
97
    private $fullStatus;
98
99
    /**
100
     * @var string
101
     */
102
    private $collectorMethod;
103
104
    /**
105
     * @var string
106
     */
107
    private $collectorReference;
108
109
    /**
110
     * @var string
111
     */
112
    private $factoringMethod;
113
114
    /**
115
     * @var string
116
     */
117
    private $factoringReference;
118
119
    /**
120
     * @var int
121
     */
122
    private $sellsFor;
123
124
    /**
125
     * @var int
126
     */
127
    private $soldFor;
128
129
    /**
130
     * @var string
131
     */
132
    private $bankgiro;
133
134
    /**
135
     * @var string
136
     */
137
    private $recipientIdentifier;
138
139
    /**
140
     * @var string
141
     */
142
    private $errorStatus;
143
144
    /**
145
     * @var int
146
     */
147
    private $totalSum;
148
149
    /**
150
     * @var int
151
     */
152
    private $remainingSum;
153
154
    /**
155
     * @var bool
156
     */
157
    private $scanningCentral;
158
159
    /**
160
     * @return string
161
     */
162
    public function getInvoiceNo(): string
163
    {
164
        return $this->invoiceNo;
165
    }
166
167
    /**
168
     * @param string $invoiceNo
169
     *
170
     * @return EventData
171
     */
172
    public function withInvoiceNo(string $invoiceNo)
173
    {
174
        $new = clone $this;
175
        $new->invoiceNo = $invoiceNo;
176
177
        return $new;
178
    }
179
180
    /**
181
     * @return string
182
     */
183
    public function getDeliveryMethod(): string
184
    {
185
        return $this->deliveryMethod;
186
    }
187
188
    /**
189
     * @param string $deliveryMethod
190
     *
191
     * @return EventData
192
     */
193
    public function withDeliveryMethod(string $deliveryMethod)
194
    {
195
        $new = clone $this;
196
        $new->deliveryMethod = $deliveryMethod;
197
198
        return $new;
199
    }
200
201
    /**
202
     * @return string
203
     */
204
    public function getLetterId(): string
205
    {
206
        return $this->letterId;
207
    }
208
209
    /**
210
     * @param string $letterId
211
     *
212
     * @return EventData
213
     */
214
    public function withLetterId(string $letterId)
215
    {
216
        $new = clone $this;
217
        $new->letterId = $letterId;
218
219
        return $new;
220
    }
221
222
    /**
223
     * @return int
224
     */
225
    public function getAmount(): int
226
    {
227
        return $this->amount;
228
    }
229
230
    /**
231
     * @param int $amount
232
     *
233
     * @return EventData
234
     */
235
    public function withAmount(int $amount)
236
    {
237
        $new = clone $this;
238
        $new->amount = $amount;
239
240
        return $new;
241
    }
242
243
    /**
244
     * @return string
245
     */
246
    public function getPayerName(): string
247
    {
248
        return $this->payerName;
249
    }
250
251
    /**
252
     * @param string $payerName
253
     *
254
     * @return EventData
255
     */
256
    public function withPayerName(string $payerName)
257
    {
258
        $new = clone $this;
259
        $new->payerName = $payerName;
260
261
        return $new;
262
    }
263
264
    /**
265
     * @return array
266
     */
267
    public function getPaymentFlags(): array
268
    {
269
        return $this->paymentFlags;
270
    }
271
272
    /**
273
     * @param array $paymentFlags
274
     *
275
     * @return EventData
276
     */
277
    public function withPaymentFlags(array $paymentFlags)
278
    {
279
        $new = clone $this;
280
        $new->paymentFlags = $paymentFlags;
281
282
        return $new;
283
    }
284
285
    /**
286
     * @return int
287
     */
288
    public function getBankingAmount(): int
289
    {
290
        return $this->bankingAmount;
291
    }
292
293
    /**
294
     * @param int $bankingAmount
295
     *
296
     * @return EventData
297
     */
298
    public function withBankingAmount(int $bankingAmount)
299
    {
300
        $new = clone $this;
301
        $new->bankingAmount = $bankingAmount;
302
303
        return $new;
304
    }
305
306
    /**
307
     * @return bool
308
     */
309
    public function isManual(): bool
310
    {
311
        return $this->manual;
312
    }
313
314
    /**
315
     * @param bool $manual
316
     *
317
     * @return EventData
318
     */
319
    public function withManual(bool $manual)
320
    {
321
        $new = clone $this;
322
        $new->manual = $manual;
323
324
        return $new;
325
    }
326
327
    /**
328
     * @return int
329
     */
330
    public function getReminderFee(): int
331
    {
332
        return $this->reminderFee;
333
    }
334
335
    /**
336
     * @param int $reminderFee
337
     *
338
     * @return EventData
339
     */
340
    public function withReminderFee(int $reminderFee)
341
    {
342
        $new = clone $this;
343
        $new->reminderFee = $reminderFee;
344
345
        return $new;
346
    }
347
348
    /**
349
     * @return int
350
     */
351
    public function getReminderCount(): int
352
    {
353
        return $this->reminderCount;
354
    }
355
356
    /**
357
     * @param int $reminderCount
358
     *
359
     * @return EventData
360
     */
361
    public function withReminderCount(int $reminderCount)
362
    {
363
        $new = clone $this;
364
        $new->reminderCount = $reminderCount;
365
366
        return $new;
367
    }
368
369
    /**
370
     * @return int
371
     */
372
    public function getInterestRate(): int
373
    {
374
        return $this->interestRate;
375
    }
376
377
    /**
378
     * @param int $interestRate
379
     *
380
     * @return EventData
381
     */
382
    public function withInterestRate(int $interestRate)
383
    {
384
        $new = clone $this;
385
        $new->interestRate = $interestRate;
386
387
        return $new;
388
    }
389
390
    /**
391
     * @return string
392
     */
393
    public function getCustomerEmail(): string
394
    {
395
        return $this->customerEmail;
396
    }
397
398
    /**
399
     * @param string $customerEmail
400
     *
401
     * @return EventData
402
     */
403
    public function withCustomerEmail(string $customerEmail)
404
    {
405
        $new = clone $this;
406
        $new->customerEmail = $customerEmail;
407
408
        return $new;
409
    }
410
411
    /**
412
     * @return string
413
     */
414
    public function getCustomerPhone(): string
415
    {
416
        return $this->customerPhone;
417
    }
418
419
    /**
420
     * @param string $customerPhone
421
     *
422
     * @return EventData
423
     */
424
    public function withCustomerPhone(string $customerPhone)
425
    {
426
        $new = clone $this;
427
        $new->customerPhone = $customerPhone;
428
429
        return $new;
430
    }
431
432
    /**
433
     * @return string
434
     */
435
    public function getIp(): string
436
    {
437
        return $this->ip;
438
    }
439
440
    /**
441
     * @param string $ip
442
     *
443
     * @return EventData
444
     */
445
    public function withIp(string $ip)
446
    {
447
        $new = clone $this;
448
        $new->ip = $ip;
449
450
        return $new;
451
    }
452
453
    /**
454
     * @return string
455
     */
456
    public function getType(): string
457
    {
458
        return $this->type;
459
    }
460
461
    /**
462
     * @param string $type
463
     *
464
     * @return EventData
465
     */
466
    public function withType(string $type)
467
    {
468
        $new = clone $this;
469
        $new->type = $type;
470
471
        return $new;
472
    }
473
474
    /**
475
     * @return \string[]
476
     */
477
    public function getMessage(): array
478
    {
479
        return $this->message;
480
    }
481
482
    /**
483
     * @param \string[] $message
484
     *
485
     * @return EventData
486
     */
487
    public function withMessage(array $message)
488
    {
489
        $new = clone $this;
490
        $new->message = $message;
0 ignored issues
show
Documentation Bug introduced by Ibrahimhizeoui
It seems like $message of type array<integer,object<string>> is incompatible with the declared type array<integer,string> of property $message.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
491
492
        return $new;
493
    }
494
495
    /**
496
     * @return string
497
     */
498
    public function getFullStatus(): string
499
    {
500
        return $this->fullStatus;
501
    }
502
503
    /**
504
     * @param string $fullStatus
505
     *
506
     * @return EventData
507
     */
508
    public function withFullStatus(string $fullStatus)
509
    {
510
        $new = clone $this;
511
        $new->fullStatus = $fullStatus;
512
513
        return $new;
514
    }
515
516
    /**
517
     * @return string
518
     */
519
    public function getCollectorMethod(): string
520
    {
521
        return $this->collectorMethod;
522
    }
523
524
    /**
525
     * @param string $collectorMethod
526
     *
527
     * @return EventData
528
     */
529
    public function setCollectorMethod(string $collectorMethod)
530
    {
531
        $new = clone $this;
532
        $new->collectorMethod = $collectorMethod;
533
534
        return $new;
535
    }
536
537
    /**
538
     * @return string
539
     */
540
    public function getCollectorReference(): string
541
    {
542
        return $this->collectorReference;
543
    }
544
545
    /**
546
     * @param string $collectorReference
547
     *
548
     * @return EventData
549
     */
550
    public function withCollectorReference(string $collectorReference)
551
    {
552
        $new = clone $this;
553
        $new->collectorReference = $collectorReference;
554
555
        return $new;
556
    }
557
558
    /**
559
     * @return string
560
     */
561
    public function getFactoringMethod(): string
562
    {
563
        return $this->factoringMethod;
564
    }
565
566
    /**
567
     * @param string $factoringMethod
568
     *
569
     * @return EventData
570
     */
571
    public function withFactoringMethod(string $factoringMethod)
572
    {
573
        $new = clone $this;
574
        $new->factoringMethod = $factoringMethod;
575
576
        return $new;
577
    }
578
579
    /**
580
     * @return string
581
     */
582
    public function getFactoringReference(): string
583
    {
584
        return $this->factoringReference;
585
    }
586
587
    /**
588
     * @param string $factoringReference
589
     *
590
     * @return EventData
591
     */
592
    public function withFactoringReference(string $factoringReference)
593
    {
594
        $new = clone $this;
595
        $new->factoringReference = $factoringReference;
596
597
        return $new;
598
    }
599
600
    /**
601
     * @return int
602
     */
603
    public function getSellsFor(): int
604
    {
605
        return $this->sellsFor;
606
    }
607
608
    /**
609
     * @param int $sellsFor
610
     *
611
     * @return EventData
612
     */
613
    public function withSellsFor(int $sellsFor)
614
    {
615
        $new = clone $this;
616
        $new->sellsFor = $sellsFor;
617
618
        return $new;
619
    }
620
621
    /**
622
     * @return int
623
     */
624
    public function getSoldFor(): int
625
    {
626
        return $this->soldFor;
627
    }
628
629
    /**
630
     * @param int $soldFor
631
     *
632
     * @return EventData
633
     */
634
    public function withSoldFor(int $soldFor)
635
    {
636
        $new = clone $this;
637
        $new->soldFor = $soldFor;
638
639
        return $new;
640
    }
641
642
    /**
643
     * @return string
644
     */
645
    public function getBankgiro(): string
646
    {
647
        return $this->bankgiro;
648
    }
649
650
    /**
651
     * @param string $bankgiro
652
     *
653
     * @return EventData
654
     */
655
    public function withBankgiro(string $bankgiro)
656
    {
657
        $new = clone $this;
658
        $new->bankgiro = $bankgiro;
659
660
        return $new;
661
    }
662
663
    /**
664
     * @return string
665
     */
666
    public function getRecipientIdentifier(): string
667
    {
668
        return $this->recipientIdentifier;
669
    }
670
671
    /**
672
     * @param string $recipientIdentifier
673
     *
674
     * @return EventData
675
     */
676
    public function withRecipientIdentifier(string $recipientIdentifier)
677
    {
678
        $new = clone $this;
679
        $new->recipientIdentifier = $recipientIdentifier;
680
681
        return $new;
682
    }
683
684
    /**
685
     * @return string
686
     */
687
    public function getErrorStatus(): string
688
    {
689
        return $this->errorStatus;
690
    }
691
692
    /**
693
     * @param string $errorStatus
694
     *
695
     * @return EventData
696
     */
697
    public function withErrorStatus(string $errorStatus)
698
    {
699
        $new = clone $this;
700
        $new->errorStatus = $errorStatus;
701
702
        return $new;
703
    }
704
705
    /**
706
     * @return int
707
     */
708
    public function getTotalSum(): int
709
    {
710
        return $this->totalSum;
711
    }
712
713
    /**
714
     * @param int $totalSum
715
     *
716
     * @return EventData
717
     */
718
    public function withTotalSum(int $totalSum)
719
    {
720
        $new = clone $this;
721
        $new->totalSum = $totalSum;
722
723
        return $new;
724
    }
725
726
    /**
727
     * @return int
728
     */
729
    public function getRemainingSum(): int
730
    {
731
        return $this->remainingSum;
732
    }
733
734
    /**
735
     * @param int $remainingSum
736
     *
737
     * @return EventData
738
     */
739
    public function withRemainingSum(int $remainingSum)
740
    {
741
        $new = clone $this;
742
        $new->remainingSum = $remainingSum;
743
744
        return $new;
745
    }
746
747
    /**
748
     * @return mixed
749
     */
750
    public function getScanningCentral()
751
    {
752
        return $this->scanningCentral;
753
    }
754
755
    /**
756
     * @param bool $scanningCentral
757
     *
758
     * @return EventData
759
     */
760
    public function withScanningCentral(bool $scanningCentral)
761
    {
762
        $new = clone $this;
763
        $new->scanningCentral = $scanningCentral;
764
765
        return $new;
766
    }
767
768
    public function toArray()
769
    {
770
        $data = [];
771
        if ($this->invoiceNo !== null) {
772
            $data['invoice_no'] = $this->invoiceNo;
773
        }
774
        if ($this->deliveryMethod !== null) {
775
            $data['delivery_method'] = $this->deliveryMethod ?? null;
776
        }
777
        if ($this->letterId !== null) {
778
            $data['letter_id'] = $this->letterId ?? null;
779
        }
780
        if ($this->amount !== null) {
781
            $data['amount'] = $this->amount ?? null;
782
        }
783
        if ($this->paymentFlags !== null) {
784
            $data['payment_flags'] = $this->paymentFlags;
785
        }
786
        if ($this->bankingAmount !== null) {
787
            $data['banking_amount'] = $this->bankingAmount;
788
        }
789
        if ($this->manual !== null) {
790
            $data['manual'] = $this->manual ?? null;
791
        }
792
        if ($this->reminderFee !== null) {
793
            $data['reminder_fee'] = $this->reminderFee ?? null;
794
        }
795
        if ($this->reminderCount !== null) {
796
            $data['reminder_count'] = $this->reminderCount ?? null;
797
        }
798
        if ($this->interestRate !== null) {
799
            $data['interest_rate'] = $this->interestRate;
800
        }
801
        if ($this->customerPhone !== null) {
802
            $data['customer_phone'] = $this->customerPhone;
803
        }
804
        if ($this->customerEmail !== null) {
805
            $data['customer_email'] = $this->customerEmail ?? null;
806
        }
807
        if ($this->ip !== null) {
808
            $data['ip'] = $this->ip ?? null;
809
        }
810
        if ($this->type !== null) {
811
            $data['type'] = $this->type ?? null;
812
        }
813
        if ($this->message !== null) {
814
            $data['message'] = $this->message;
815
        }
816
        if ($this->fullStatus !== null) {
817
            $data['full_status'] = $this->fullStatus;
818
        }
819
        if ($this->collectorMethod !== null) {
820
            $data['collector_method'] = $this->collectorMethod ?? null;
821
        }
822
        if ($this->collectorReference !== null) {
823
            $data['collector_reference'] = $this->collectorReference ?? null;
824
        }
825
        if ($this->factoringMethod !== null) {
826
            $data['factoring_method'] = $this->factoringMethod ?? null;
827
        }
828
        if ($this->factoringReference !== null) {
829
            $data['factoring_reference'] = $this->factoringReference;
830
        }
831
        if ($this->sellsFor !== null) {
832
            $data['sells_for'] = $this->sellsFor ?? null;
833
        }
834
        if ($this->soldFor !== null) {
835
            $data['sold_for'] = $this->soldFor ?? null;
836
        }
837
        if ($this->bankgiro !== null) {
838
            $data['bankgiro'] = $this->bankgiro;
839
        }
840
        if ($this->recipientIdentifier !== null) {
841
            $data['recipient_identifier'] = $this->recipientIdentifier ?? null;
842
        }
843
        if ($this->errorStatus !== null) {
844
            $data['error_status'] = $this->errorStatus;
845
        }
846
        if ($this->totalSum !== null) {
847
            $data['total_sum'] = $this->totalSum ?? null;
848
        }
849
        if ($this->remainingSum !== null) {
850
            $data['remaining_sum'] = $this->remainingSum ?? null;
851
        }
852
        if ($this->scanningCentral !== null) {
853
            $data['scanning_central'] = $this->scanningCentral;
854
        }
855
856
        return $data;
857
    }
858
859
    /**
860
     * Create an API response object from the HTTP response from the API server.
861
     *
862
     * @param array $data
863
     *
864
     * @return self
865
     */
866 3
    public static function createFromArray(array $data = null)
867
    {
868 3
        $eventData = new self();
869 3
        $eventData->invoiceNo = $data['invoice_no'];
870 3
        $eventData->deliveryMethod = $data['delivery_method'];
871 3
        $eventData->letterId = $data['letter_id'];
872 3
        $eventData->amount = $data['amount'];
873 3
        $eventData->payerName = $data['payer_name'];
874 3
        $eventData->paymentFlags = $data['payment_flags'];
875 3
        $eventData->bankingAmount = $data['banking_amount'];
876 3
        $eventData->manual = $data['manual'];
877 3
        $eventData->reminderFee = $data['reminder_fee'];
878 3
        $eventData->reminderCount = $data['reminder_count'];
879 3
        $eventData->interestRate = $data['interest_rate'];
880 3
        $eventData->customerPhone = $data['customer_phone'];
881 3
        $eventData->ip = $data['ip'];
882 3
        $eventData->type = $data['type'];
883
        //$eventData->message = $data['message'];
0 ignored issues
show
Unused Code Comprehensibility introduced by Ibrahimhizeoui
64% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
884 3
        $eventData->fullStatus = $data['full_status'];
885 3
        $eventData->collectorMethod = $data['collector_method'];
886 3
        $eventData->collectorReference = $data['collector_reference'];
887 3
        $eventData->factoringMethod = $data['factoring_method'];
888 3
        $eventData->factoringReference = $data['factoring_reference'];
889 3
        $eventData->sellsFor = $data['sells_for'];
890 3
        $eventData->soldFor = $data['sold_for'];
891 3
        $eventData->bankgiro = $data['bankgiro'];
892 3
        $eventData->recipientIdentifier = $data['recipient_identifier'];
893 3
        $eventData->errorStatus = $data['error_status'];
894 3
        $eventData->totalSum = $data['total_sum'];
895 3
        $eventData->remainingSum = $data['remaining_sum'];
896 3
        $eventData->scanningCentral = $data['scanning_central'];
897
898 3
        return $eventData;
899
    }
900
}
901