BookingDetails   F
last analyzed

Complexity

Total Complexity 83

Size/Duplication

Total Lines 913
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 83
lcom 0
cbo 1
dl 0
loc 913
ccs 0
cts 374
cp 0
rs 1.687
c 0
b 0
f 0

83 Methods

Rating   Name   Duplication   Size   Complexity  
A getReservationId() 0 4 1
A setReservationId() 0 4 1
A getStatus() 0 4 1
A setStatus() 0 4 1
A getAffiliateId() 0 4 1
A setAffiliateId() 0 4 1
A getAffiliateLabel() 0 4 1
A setAffiliateLabel() 0 4 1
A getChainIds() 0 4 1
A setChainIds() 0 4 1
A getHotelId() 0 4 1
A setHotelId() 0 4 1
A getHotelName() 0 4 1
A setHotelName() 0 4 1
A getHotelFax() 0 4 1
A setHotelFax() 0 4 1
A getHotelAddress() 0 4 1
A setHotelAddress() 0 4 1
A getHotelZipcode() 0 4 1
A setHotelZipcode() 0 4 1
A getDestinationUfi() 0 4 1
A setDestinationUfi() 0 4 1
A getHotelCountrycode() 0 4 1
A setHotelCountrycode() 0 4 1
A getBookerFirstname() 0 4 1
A setBookerFirstname() 0 4 1
A getBookerLastname() 0 4 1
A setBookerLastname() 0 4 1
A getBookerPhone() 0 4 1
A setBookerPhone() 0 4 1
A getBookerEmail() 0 4 1
A setBookerEmail() 0 4 1
A getBookerMailinglist() 0 4 1
A setBookerMailinglist() 0 4 1
A getGuestName() 0 4 1
A setGuestName() 0 4 1
A getGuestCity() 0 4 1
A setGuestCity() 0 4 1
A getGuestCountry() 0 4 1
A setGuestCountry() 0 4 1
A getLoyaltyMemberId() 0 4 1
A setLoyaltyMemberId() 0 4 1
A getPincode() 0 4 1
A setPincode() 0 4 1
A getLanguage() 0 4 1
A setLanguage() 0 4 1
A getCreated() 0 4 1
A setCreated() 0 4 1
A getCheckin() 0 4 1
A setCheckin() 0 4 1
A getCheckout() 0 4 1
A setCheckout() 0 4 1
A getCancellationDate() 0 4 1
A setCancellationDate() 0 4 1
A getFeeCalculationDate() 0 4 1
A setFeeCalculationDate() 0 4 1
A getFeePercentage() 0 4 1
A setFeePercentage() 0 4 1
A getEuroFee() 0 4 1
A setEuroFee() 0 4 1
A getLocalFee() 0 4 1
A setLocalFee() 0 4 1
A getLocalFeeCurrency() 0 4 1
A setLocalFeeCurrency() 0 4 1
A getPriceEuro() 0 4 1
A setPriceEuro() 0 4 1
A getPriceLocal() 0 4 1
A setPriceLocal() 0 4 1
A getCurrency() 0 4 1
A setCurrency() 0 4 1
A getCreditslip() 0 4 1
A setCreditslip() 0 4 1
A getTotalRoomNights() 0 4 1
A setTotalRoomNights() 0 4 1
A getNrRooms() 0 4 1
A setNrRooms() 0 4 1
A getNrGuests() 0 4 1
A setNrGuests() 0 4 1
A getUrl() 0 4 1
A setUrl() 0 4 1
A getStayProbability() 0 4 1
A setStayProbability() 0 4 1
A getAttributeMap() 0 46 1

How to fix   Complexity   

Complex Class

Complex classes like BookingDetails often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use BookingDetails, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
namespace DJStarCOM\BookingComSDK\Models;
4
5
/**
6
 * Class BookingDetails
7
 * @package DJStarCOM\BookingComSDK\Models
8
 */
9
class BookingDetails extends Model
10
{
11
    /**
12
     * @var int
13
     */
14
    protected $reservation_id;
15
16
    /**
17
     * @var string
18
     */
19
    protected $status;
20
21
    /**
22
     * @var int
23
     */
24
    protected $affiliate_id;
25
26
    /**
27
     * @var string
28
     */
29
    protected $affiliate_label;
30
31
    /**
32
     * @var string
33
     */
34
    protected $chain_ids;
35
36
    /**
37
     * @var int
38
     */
39
    protected $hotel_id;
40
41
    /**
42
     * @var string
43
     */
44
    protected $hotel_name;
45
46
    /**
47
     * @var string
48
     */
49
    protected $hotel_fax;
50
51
    /**
52
     * @var string
53
     */
54
    protected $hotel_address;
55
56
    /**
57
     * @var string
58
     */
59
    protected $hotel_zipcode;
60
61
    /**
62
     * @var string
63
     */
64
    protected $destination_ufi;
65
66
    /**
67
     * @var string
68
     */
69
    protected $hotel_countrycode;
70
71
    /**
72
     * @var string
73
     */
74
    protected $booker_firstname;
75
76
    /**
77
     * @var string
78
     */
79
    protected $booker_lastname;
80
81
    /**
82
     * @var string|null
83
     */
84
    protected $booker_phone;
85
86
    /**
87
     * @var string
88
     */
89
    protected $booker_email;
90
91
    /**
92
     * @var string
93
     */
94
    protected $booker_mailinglist;
95
96
    /**
97
     * @var string
98
     */
99
    protected $guest_name;
100
101
    /**
102
     * @var string
103
     */
104
    protected $guest_city;
105
106
    /**
107
     * @var string
108
     */
109
    protected $guest_country;
110
111
    /**
112
     * @var string
113
     */
114
    protected $loyalty_member_id;
115
116
    /**
117
     * @var string
118
     */
119
    protected $pincode;
120
121
    /**
122
     * @var string
123
     */
124
    protected $language;
125
126
    /**
127
     * @var string
128
     */
129
    protected $created;
130
131
    /**
132
     * @var string|null
133
     */
134
    protected $checkin;
135
136
    /**
137
     * @var string|null
138
     */
139
    protected $checkout;
140
141
    /**
142
     * @var string
143
     */
144
    protected $cancellation_date;
145
146
    /**
147
     * @var string
148
     */
149
    protected $fee_calculation_date;
150
151
    /**
152
     * @var int|null
153
     */
154
    protected $fee_percentage;
155
156
    /**
157
     * @var float|null
158
     */
159
    protected $euro_fee;
160
161
    /**
162
     * @var float|null
163
     */
164
    protected $local_fee;
165
166
    /**
167
     * @var string
168
     */
169
    protected $local_fee_currency;
170
171
    /**
172
     * @var float|null
173
     */
174
    protected $price_euro;
175
176
    /**
177
     * @var float|null
178
     */
179
    protected $price_local;
180
181
    /**
182
     * @var string
183
     */
184
    protected $currency;
185
186
    /**
187
     * @var int
188
     */
189
    protected $creditslip;
190
191
    /**
192
     * @var int
193
     */
194
    protected $total_room_nights;
195
196
    /**
197
     * @var int
198
     */
199
    protected $nr_rooms;
200
201
    /**
202
     * @var int
203
     */
204
    protected $nr_guests;
205
206
    /**
207
     * @var string
208
     */
209
    protected $url;
210
211
    /**
212
     * @var float|null
213
     */
214
    protected $stay_probability;
215
216
    /**
217
     * @return int
218
     */
219
    public function getReservationId(): int
220
    {
221
        return $this->reservation_id;
222
    }
223
224
    /**
225
     * @param int $reservation_id
226
     */
227
    public function setReservationId(int $reservation_id): void
228
    {
229
        $this->reservation_id = $reservation_id;
230
    }
231
232
    /**
233
     * @return string
234
     */
235
    public function getStatus(): string
236
    {
237
        return $this->status;
238
    }
239
240
    /**
241
     * @param string $status
242
     */
243
    public function setStatus(string $status): void
244
    {
245
        $this->status = $status;
246
    }
247
248
    /**
249
     * @return int
250
     */
251
    public function getAffiliateId(): int
252
    {
253
        return $this->affiliate_id;
254
    }
255
256
    /**
257
     * @param int $affiliate_id
258
     */
259
    public function setAffiliateId(int $affiliate_id): void
260
    {
261
        $this->affiliate_id = $affiliate_id;
262
    }
263
264
    /**
265
     * @return string
266
     */
267
    public function getAffiliateLabel(): ?string
268
    {
269
        return $this->affiliate_label;
270
    }
271
272
    /**
273
     * @param string $affiliate_label
274
     */
275
    public function setAffiliateLabel(?string $affiliate_label): void
276
    {
277
        $this->affiliate_label = $affiliate_label;
278
    }
279
280
    /**
281
     * @return string
282
     */
283
    public function getChainIds(): ?string
284
    {
285
        return $this->chain_ids;
286
    }
287
288
    /**
289
     * @param string $chain_ids
290
     */
291
    public function setChainIds(?string $chain_ids): void
292
    {
293
        $this->chain_ids = $chain_ids;
294
    }
295
296
    /**
297
     * @return int
298
     */
299
    public function getHotelId(): int
300
    {
301
        return $this->hotel_id;
302
    }
303
304
    /**
305
     * @param int $hotel_id
306
     */
307
    public function setHotelId(int $hotel_id): void
308
    {
309
        $this->hotel_id = $hotel_id;
310
    }
311
312
    /**
313
     * @return string
314
     */
315
    public function getHotelName(): ?string
316
    {
317
        return $this->hotel_name;
318
    }
319
320
    /**
321
     * @param string $hotel_name
322
     */
323
    public function setHotelName(?string $hotel_name): void
324
    {
325
        $this->hotel_name = $hotel_name;
326
    }
327
328
    /**
329
     * @return string
330
     */
331
    public function getHotelFax(): ?string
332
    {
333
        return $this->hotel_fax;
334
    }
335
336
    /**
337
     * @param string $hotel_fax
338
     */
339
    public function setHotelFax(?string $hotel_fax): void
340
    {
341
        $this->hotel_fax = $hotel_fax;
342
    }
343
344
    /**
345
     * @return string
346
     */
347
    public function getHotelAddress(): ?string
348
    {
349
        return $this->hotel_address;
350
    }
351
352
    /**
353
     * @param string $hotel_address
354
     */
355
    public function setHotelAddress(?string $hotel_address): void
356
    {
357
        $this->hotel_address = $hotel_address;
358
    }
359
360
    /**
361
     * @return string
362
     */
363
    public function getHotelZipcode(): ?string
364
    {
365
        return $this->hotel_zipcode;
366
    }
367
368
    /**
369
     * @param string $hotel_zipcode
370
     */
371
    public function setHotelZipcode(?string $hotel_zipcode): void
372
    {
373
        $this->hotel_zipcode = $hotel_zipcode;
374
    }
375
376
    /**
377
     * @return string
378
     */
379
    public function getDestinationUfi(): ?string
380
    {
381
        return $this->destination_ufi;
382
    }
383
384
    /**
385
     * @param string $destination_ufi
386
     */
387
    public function setDestinationUfi(?string $destination_ufi): void
388
    {
389
        $this->destination_ufi = $destination_ufi;
390
    }
391
392
    /**
393
     * @return string
394
     */
395
    public function getHotelCountrycode(): ?string
396
    {
397
        return $this->hotel_countrycode;
398
    }
399
400
    /**
401
     * @param string $hotel_countrycode
402
     */
403
    public function setHotelCountrycode(?string $hotel_countrycode): void
404
    {
405
        $this->hotel_countrycode = $hotel_countrycode;
406
    }
407
408
    /**
409
     * @return null|string
410
     */
411
    public function getBookerFirstname(): ?string
412
    {
413
        return $this->booker_firstname;
414
    }
415
416
    /**
417
     * @param null|string $booker_firstname
418
     */
419
    public function setBookerFirstname(?string $booker_firstname): void
420
    {
421
        $this->booker_firstname = $booker_firstname;
422
    }
423
424
    /**
425
     * @return null|string
426
     */
427
    public function getBookerLastname(): ?string
428
    {
429
        return $this->booker_lastname;
430
    }
431
432
    /**
433
     * @param null|string $booker_lastname
434
     */
435
    public function setBookerLastname(?string $booker_lastname): void
436
    {
437
        $this->booker_lastname = $booker_lastname;
438
    }
439
440
    /**
441
     * @return string|null
442
     */
443
    public function getBookerPhone(): ?string
444
    {
445
        return $this->booker_phone;
446
    }
447
448
    /**
449
     * @param string|null $booker_phone
450
     */
451
    public function setBookerPhone(?string $booker_phone): void
452
    {
453
        $this->booker_phone = $booker_phone;
454
    }
455
456
    /**
457
     * @return string
458
     */
459
    public function getBookerEmail(): string
460
    {
461
        return $this->booker_email;
462
    }
463
464
    /**
465
     * @param string $booker_email
466
     */
467
    public function setBookerEmail(string $booker_email): void
468
    {
469
        $this->booker_email = $booker_email;
470
    }
471
472
    /**
473
     * @return string
474
     */
475
    public function getBookerMailinglist(): ?string
476
    {
477
        return $this->booker_mailinglist;
478
    }
479
480
    /**
481
     * @param string $booker_mailinglist
482
     */
483
    public function setBookerMailinglist(?string $booker_mailinglist): void
484
    {
485
        $this->booker_mailinglist = $booker_mailinglist;
486
    }
487
488
    /**
489
     * @return string
490
     */
491
    public function getGuestName(): ?string
492
    {
493
        return $this->guest_name;
494
    }
495
496
    /**
497
     * @param string $guest_name
498
     */
499
    public function setGuestName(?string $guest_name): void
500
    {
501
        $this->guest_name = $guest_name;
502
    }
503
504
    /**
505
     * @return string
506
     */
507
    public function getGuestCity(): ?string
508
    {
509
        return $this->guest_city;
510
    }
511
512
    /**
513
     * @param string $guest_city
514
     */
515
    public function setGuestCity(?string $guest_city): void
516
    {
517
        $this->guest_city = $guest_city;
518
    }
519
520
    /**
521
     * @return string
522
     */
523
    public function getGuestCountry(): ?string
524
    {
525
        return $this->guest_country;
526
    }
527
528
    /**
529
     * @param string $guest_country
530
     */
531
    public function setGuestCountry(?string $guest_country): void
532
    {
533
        $this->guest_country = $guest_country;
534
    }
535
536
    /**
537
     * @return string
538
     */
539
    public function getLoyaltyMemberId(): ?string
540
    {
541
        return $this->loyalty_member_id;
542
    }
543
544
    /**
545
     * @param string $loyalty_member_id
546
     */
547
    public function setLoyaltyMemberId(?string $loyalty_member_id): void
548
    {
549
        $this->loyalty_member_id = $loyalty_member_id;
550
    }
551
552
    /**
553
     * @return string
554
     */
555
    public function getPincode(): string
556
    {
557
        return $this->pincode;
558
    }
559
560
    /**
561
     * @param string $pincode
562
     */
563
    public function setPincode(string $pincode): void
564
    {
565
        $this->pincode = $pincode;
566
    }
567
568
    /**
569
     * @return string
570
     */
571
    public function getLanguage(): string
572
    {
573
        return $this->language;
574
    }
575
576
    /**
577
     * @param string $language
578
     */
579
    public function setLanguage(string $language): void
580
    {
581
        $this->language = $language;
582
    }
583
584
    /**
585
     * @return string
586
     */
587
    public function getCreated(): string
588
    {
589
        return $this->created;
590
    }
591
592
    /**
593
     * @param string $created
594
     */
595
    public function setCreated(string $created): void
596
    {
597
        $this->created = $created;
598
    }
599
600
    /**
601
     * @return string|null
602
     */
603
    public function getCheckin(): ?string
604
    {
605
        return $this->checkin;
606
    }
607
608
    /**
609
     * @param string|null $checkin
610
     */
611
    public function setCheckin(?string $checkin): void
612
    {
613
        $this->checkin = $checkin;
614
    }
615
616
    /**
617
     * @return string|null
618
     */
619
    public function getCheckout(): ?string
620
    {
621
        return $this->checkout;
622
    }
623
624
    /**
625
     * @param string|null $checkout
626
     */
627
    public function setCheckout(?string $checkout): void
628
    {
629
        $this->checkout = $checkout;
630
    }
631
632
    /**
633
     * @return string
634
     */
635
    public function getCancellationDate(): ?string
636
    {
637
        return $this->cancellation_date;
638
    }
639
640
    /**
641
     * @param string $cancellation_date
642
     */
643
    public function setCancellationDate(?string $cancellation_date): void
644
    {
645
        $this->cancellation_date = $cancellation_date;
646
    }
647
648
    /**
649
     * @return string
650
     */
651
    public function getFeeCalculationDate(): ?string
652
    {
653
        return $this->fee_calculation_date;
654
    }
655
656
    /**
657
     * @param string $fee_calculation_date
658
     */
659
    public function setFeeCalculationDate(?string $fee_calculation_date): void
660
    {
661
        $this->fee_calculation_date = $fee_calculation_date;
662
    }
663
664
    /**
665
     * @return int|null
666
     */
667
    public function getFeePercentage(): ?int
668
    {
669
        return $this->fee_percentage;
670
    }
671
672
    /**
673
     * @param int|null $fee_percentage
674
     */
675
    public function setFeePercentage(?int $fee_percentage): void
676
    {
677
        $this->fee_percentage = $fee_percentage;
678
    }
679
680
    /**
681
     * @return float|null
682
     */
683
    public function getEuroFee(): ?float
684
    {
685
        return $this->euro_fee;
686
    }
687
688
    /**
689
     * @param float|null $euro_fee
690
     */
691
    public function setEuroFee(?float $euro_fee): void
692
    {
693
        $this->euro_fee = $euro_fee;
694
    }
695
696
    /**
697
     * @return float
698
     */
699
    public function getLocalFee(): ?float
700
    {
701
        return $this->local_fee;
702
    }
703
704
    /**
705
     * @param float $local_fee
706
     */
707
    public function setLocalFee(?float $local_fee): void
708
    {
709
        $this->local_fee = $local_fee;
710
    }
711
712
    /**
713
     * @return string
714
     */
715
    public function getLocalFeeCurrency(): ?string
716
    {
717
        return $this->local_fee_currency;
718
    }
719
720
    /**
721
     * @param string $local_fee_currency
722
     */
723
    public function setLocalFeeCurrency(?string $local_fee_currency): void
724
    {
725
        $this->local_fee_currency = $local_fee_currency;
726
    }
727
728
    /**
729
     * @return float|null
730
     */
731
    public function getPriceEuro(): ?float
732
    {
733
        return $this->price_euro;
734
    }
735
736
    /**
737
     * @param float|null $price_euro
738
     */
739
    public function setPriceEuro(?float $price_euro): void
740
    {
741
        $this->price_euro = $price_euro;
742
    }
743
744
    /**
745
     * @return float|null
746
     */
747
    public function getPriceLocal(): ?float
748
    {
749
        return $this->price_local;
750
    }
751
752
    /**
753
     * @param float|null $price_local
754
     */
755
    public function setPriceLocal(?float $price_local): void
756
    {
757
        $this->price_local = $price_local;
758
    }
759
760
    /**
761
     * @return string
762
     */
763
    public function getCurrency(): string
764
    {
765
        return $this->currency;
766
    }
767
768
    /**
769
     * @param string $currency
770
     */
771
    public function setCurrency(string $currency): void
772
    {
773
        $this->currency = $currency;
774
    }
775
776
    /**
777
     * @return string
778
     */
779
    public function getCreditslip(): ?string
780
    {
781
        return $this->creditslip;
782
    }
783
784
    /**
785
     * @param string $creditslip
786
     */
787
    public function setCreditslip(?string $creditslip): void
788
    {
789
        $this->creditslip = $creditslip;
0 ignored issues
show
Documentation Bug introduced by
The property $creditslip was declared of type integer, but $creditslip is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
790
    }
791
792
    /**
793
     * @return int
794
     */
795
    public function getTotalRoomNights(): ?int
796
    {
797
        return $this->total_room_nights;
798
    }
799
800
    /**
801
     * @param int $total_room_nights
802
     */
803
    public function setTotalRoomNights(?int $total_room_nights): void
804
    {
805
        $this->total_room_nights = $total_room_nights;
806
    }
807
808
    /**
809
     * @return int
810
     */
811
    public function getNrRooms(): ?int
812
    {
813
        return $this->nr_rooms;
814
    }
815
816
    /**
817
     * @param int $nr_rooms
818
     */
819
    public function setNrRooms(?int $nr_rooms): void
820
    {
821
        $this->nr_rooms = $nr_rooms;
822
    }
823
824
    /**
825
     * @return int
826
     */
827
    public function getNrGuests(): ?int
828
    {
829
        return $this->nr_guests;
830
    }
831
832
    /**
833
     * @param int $nr_guests
834
     */
835
    public function setNrGuests(?int $nr_guests): void
836
    {
837
        $this->nr_guests = $nr_guests;
838
    }
839
840
    /**
841
     * @return string
842
     */
843
    public function getUrl(): ?string
844
    {
845
        return $this->url;
846
    }
847
848
    /**
849
     * @param string $url
850
     */
851
    public function setUrl(?string $url): void
852
    {
853
        $this->url = $url;
854
    }
855
856
    /**
857
     * @return float|null
858
     */
859
    public function getStayProbability(): ?float
860
    {
861
        return $this->stay_probability;
862
    }
863
864
    /**
865
     * @param float|null $stay_probability
866
     */
867
    public function setStayProbability(?float $stay_probability): void
868
    {
869
        $this->stay_probability = $stay_probability;
870
    }
871
872
    /**
873
     * @return array
874
     */
875
    protected function getAttributeMap(): array
876
    {
877
        return [
878
            'reservation_id'       => 'int',
879
            'status'               => 'string',
880
            'affiliate_id'         => 'int',
881
            'affiliate_label'      => 'string',
882
            'chain_ids'            => 'string',
883
            'hotel_id'             => 'int',
884
            'hotel_name'           => 'string',
885
            'hotel_fax'            => 'string',
886
            'hotel_address'        => 'string',
887
            'hotel_zipcode'        => 'string',
888
            'destination_ufi'      => 'string',
889
            'hotel_countrycode'    => 'string',
890
            'booker_firstname'     => 'string',
891
            'booker_lastname'      => 'string',
892
            'booker_phone'         => 'string',
893
            'booker_email'         => 'string',
894
            'booker_mailinglist'   => 'string',
895
            'guest_name'           => 'string',
896
            'guest_city'           => 'string',
897
            'guest_country'        => 'string',
898
            'loyalty_member_id'    => 'string',
899
            'pincode'              => 'string',
900
            'language'             => 'string',
901
            'created'              => 'string',
902
            'checkin'              => 'string',
903
            'checkout'             => 'string',
904
            'cancellation_date'    => 'string',
905
            'fee_calculation_date' => 'string',
906
            'fee_percentage'       => 'int',
907
            'euro_fee'             => 'float',
908
            'local_fee'            => 'float',
909
            'local_fee_currency'   => 'string',
910
            'price_euro'           => 'float',
911
            'price_local'          => 'float',
912
            'currency'             => 'string',
913
            'creditslip'           => 'int',
914
            'total_room_nights'    => 'int',
915
            'nr_rooms'             => 'int',
916
            'nr_guests'            => 'int',
917
            'url'                  => 'string',
918
            'stay_probability'     => 'float',
919
        ];
920
    }
921
}
922