Complex classes like OwnerReservations 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 OwnerReservations, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
5 | class OwnerReservations |
||
6 | { |
||
7 | |||
8 | /** |
||
9 | * @var int $ID_Guest |
||
10 | */ |
||
11 | protected $ID_Guest = null; |
||
12 | |||
13 | /** |
||
14 | * @var int $ID_Room |
||
15 | */ |
||
16 | protected $ID_Room = null; |
||
17 | |||
18 | /** |
||
19 | * @var \DateTime $ArrivalDate |
||
20 | */ |
||
21 | protected $ArrivalDate = null; |
||
22 | |||
23 | /** |
||
24 | * @var \DateTime $DepartureDate |
||
25 | */ |
||
26 | protected $DepartureDate = null; |
||
27 | |||
28 | /** |
||
29 | * @var int $RoomQty |
||
30 | */ |
||
31 | protected $RoomQty = null; |
||
32 | |||
33 | /** |
||
34 | * @var int $AccountStatus |
||
35 | */ |
||
36 | protected $AccountStatus = null; |
||
37 | |||
38 | /** |
||
39 | * @var int $LedgerStatus |
||
40 | */ |
||
41 | protected $LedgerStatus = null; |
||
42 | |||
43 | /** |
||
44 | * @var int $ID_Property |
||
45 | */ |
||
46 | protected $ID_Property = null; |
||
47 | |||
48 | /** |
||
49 | * @var int $AccountNo |
||
50 | */ |
||
51 | protected $AccountNo = null; |
||
52 | |||
53 | /** |
||
54 | * @var string $AccountName |
||
55 | */ |
||
56 | protected $AccountName = null; |
||
57 | |||
58 | /** |
||
59 | * @var float $TotalFolios |
||
60 | */ |
||
61 | protected $TotalFolios = null; |
||
62 | |||
63 | /** |
||
64 | * @var string $PropertyGUID |
||
65 | */ |
||
66 | protected $PropertyGUID = null; |
||
67 | |||
68 | /** |
||
69 | * @var string $PropertyCode |
||
70 | */ |
||
71 | protected $PropertyCode = null; |
||
72 | |||
73 | /** |
||
74 | * @var boolean $IsGuaranteed |
||
75 | */ |
||
76 | protected $IsGuaranteed = null; |
||
77 | |||
78 | /** |
||
79 | * @var int $BookingCondoType |
||
80 | */ |
||
81 | protected $BookingCondoType = null; |
||
82 | |||
83 | /** |
||
84 | * @var string $RoomNo |
||
85 | */ |
||
86 | protected $RoomNo = null; |
||
87 | |||
88 | /** |
||
89 | * @var int $ID_RoomTypeOcc |
||
90 | */ |
||
91 | protected $ID_RoomTypeOcc = null; |
||
92 | |||
93 | /** |
||
94 | * @var int $ID_SuiteConfiguration |
||
95 | */ |
||
96 | protected $ID_SuiteConfiguration = null; |
||
97 | |||
98 | /** |
||
99 | * @var int $HSKRoomStatusType |
||
100 | */ |
||
101 | protected $HSKRoomStatusType = null; |
||
102 | |||
103 | /** |
||
104 | * @var int $HSKRoomInspectionType |
||
105 | */ |
||
106 | protected $HSKRoomInspectionType = null; |
||
107 | |||
108 | /** |
||
109 | * @var boolean $IsHSKRoomOccupied |
||
110 | */ |
||
111 | protected $IsHSKRoomOccupied = null; |
||
112 | |||
113 | /** |
||
114 | * @var int $ID_Member |
||
115 | */ |
||
116 | protected $ID_Member = null; |
||
117 | |||
118 | /** |
||
119 | * @var int $ID_Admin |
||
120 | */ |
||
121 | protected $ID_Admin = null; |
||
122 | |||
123 | /** |
||
124 | * @var int $ID_CondoOwner |
||
125 | */ |
||
126 | protected $ID_CondoOwner = null; |
||
127 | |||
128 | /** |
||
129 | * @var \DateTime $SystemCreationDate |
||
130 | */ |
||
131 | protected $SystemCreationDate = null; |
||
132 | |||
133 | /** |
||
134 | * @var float $StayValue |
||
135 | */ |
||
136 | protected $StayValue = null; |
||
137 | |||
138 | /** |
||
139 | * @var float $GrossRevenue |
||
140 | */ |
||
141 | protected $GrossRevenue = null; |
||
142 | |||
143 | /** |
||
144 | * @var boolean $IsInternalReferal |
||
145 | */ |
||
146 | protected $IsInternalReferal = null; |
||
147 | |||
148 | /** |
||
149 | * @var int $ID_Referal |
||
150 | */ |
||
151 | protected $ID_Referal = null; |
||
152 | |||
153 | /** |
||
154 | * @var boolean $IsRBO |
||
155 | */ |
||
156 | protected $IsRBO = null; |
||
157 | |||
158 | /** |
||
159 | * @var string $RateCodeName |
||
160 | */ |
||
161 | protected $RateCodeName = null; |
||
162 | |||
163 | /** |
||
164 | * @var float $GrossRevenueTotal |
||
165 | */ |
||
166 | protected $GrossRevenueTotal = null; |
||
167 | |||
168 | /** |
||
169 | * @param int $ID_Guest |
||
170 | * @param int $ID_Room |
||
171 | * @param \DateTime $ArrivalDate |
||
172 | * @param \DateTime $DepartureDate |
||
173 | * @param int $RoomQty |
||
174 | * @param int $AccountStatus |
||
175 | * @param int $LedgerStatus |
||
176 | * @param int $ID_Property |
||
177 | * @param int $AccountNo |
||
178 | * @param string $AccountName |
||
179 | * @param float $TotalFolios |
||
180 | * @param string $PropertyGUID |
||
181 | * @param string $PropertyCode |
||
182 | * @param boolean $IsGuaranteed |
||
183 | * @param int $BookingCondoType |
||
184 | * @param string $RoomNo |
||
185 | * @param int $ID_RoomTypeOcc |
||
186 | * @param int $ID_SuiteConfiguration |
||
187 | * @param int $HSKRoomStatusType |
||
188 | * @param int $HSKRoomInspectionType |
||
189 | * @param boolean $IsHSKRoomOccupied |
||
190 | * @param int $ID_Member |
||
191 | * @param int $ID_Admin |
||
192 | * @param int $ID_CondoOwner |
||
193 | * @param \DateTime $SystemCreationDate |
||
194 | * @param float $StayValue |
||
195 | * @param float $GrossRevenue |
||
196 | * @param boolean $IsInternalReferal |
||
197 | * @param int $ID_Referal |
||
198 | * @param boolean $IsRBO |
||
199 | * @param string $RateCodeName |
||
200 | * @param float $GrossRevenueTotal |
||
201 | */ |
||
202 | public function __construct($ID_Guest, $ID_Room, \DateTime $ArrivalDate, \DateTime $DepartureDate, $RoomQty, $AccountStatus, $LedgerStatus, $ID_Property, $AccountNo, $AccountName, $TotalFolios, $PropertyGUID, $PropertyCode, $IsGuaranteed, $BookingCondoType, $RoomNo, $ID_RoomTypeOcc, $ID_SuiteConfiguration, $HSKRoomStatusType, $HSKRoomInspectionType, $IsHSKRoomOccupied, $ID_Member, $ID_Admin, $ID_CondoOwner, \DateTime $SystemCreationDate, $StayValue, $GrossRevenue, $IsInternalReferal, $ID_Referal, $IsRBO, $RateCodeName, $GrossRevenueTotal) |
||
237 | |||
238 | /** |
||
239 | * @return int |
||
240 | */ |
||
241 | public function getID_Guest() |
||
245 | |||
246 | /** |
||
247 | * @param int $ID_Guest |
||
248 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
249 | */ |
||
250 | public function setID_Guest($ID_Guest) |
||
255 | |||
256 | /** |
||
257 | * @return int |
||
258 | */ |
||
259 | public function getID_Room() |
||
263 | |||
264 | /** |
||
265 | * @param int $ID_Room |
||
266 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
267 | */ |
||
268 | public function setID_Room($ID_Room) |
||
273 | |||
274 | /** |
||
275 | * @return \DateTime |
||
276 | */ |
||
277 | public function getArrivalDate() |
||
289 | |||
290 | /** |
||
291 | * @param \DateTime $ArrivalDate |
||
292 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
293 | */ |
||
294 | public function setArrivalDate(\DateTime $ArrivalDate) |
||
299 | |||
300 | /** |
||
301 | * @return \DateTime |
||
302 | */ |
||
303 | public function getDepartureDate() |
||
315 | |||
316 | /** |
||
317 | * @param \DateTime $DepartureDate |
||
318 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
319 | */ |
||
320 | public function setDepartureDate(\DateTime $DepartureDate) |
||
325 | |||
326 | /** |
||
327 | * @return int |
||
328 | */ |
||
329 | public function getRoomQty() |
||
333 | |||
334 | /** |
||
335 | * @param int $RoomQty |
||
336 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
337 | */ |
||
338 | public function setRoomQty($RoomQty) |
||
343 | |||
344 | /** |
||
345 | * @return int |
||
346 | */ |
||
347 | public function getAccountStatus() |
||
351 | |||
352 | /** |
||
353 | * @param int $AccountStatus |
||
354 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
355 | */ |
||
356 | public function setAccountStatus($AccountStatus) |
||
361 | |||
362 | /** |
||
363 | * @return int |
||
364 | */ |
||
365 | public function getLedgerStatus() |
||
369 | |||
370 | /** |
||
371 | * @param int $LedgerStatus |
||
372 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
373 | */ |
||
374 | public function setLedgerStatus($LedgerStatus) |
||
379 | |||
380 | /** |
||
381 | * @return int |
||
382 | */ |
||
383 | public function getID_Property() |
||
387 | |||
388 | /** |
||
389 | * @param int $ID_Property |
||
390 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
391 | */ |
||
392 | public function setID_Property($ID_Property) |
||
397 | |||
398 | /** |
||
399 | * @return int |
||
400 | */ |
||
401 | public function getAccountNo() |
||
405 | |||
406 | /** |
||
407 | * @param int $AccountNo |
||
408 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
409 | */ |
||
410 | public function setAccountNo($AccountNo) |
||
415 | |||
416 | /** |
||
417 | * @return string |
||
418 | */ |
||
419 | public function getAccountName() |
||
423 | |||
424 | /** |
||
425 | * @param string $AccountName |
||
426 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
427 | */ |
||
428 | public function setAccountName($AccountName) |
||
433 | |||
434 | /** |
||
435 | * @return float |
||
436 | */ |
||
437 | public function getTotalFolios() |
||
441 | |||
442 | /** |
||
443 | * @param float $TotalFolios |
||
444 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
445 | */ |
||
446 | public function setTotalFolios($TotalFolios) |
||
451 | |||
452 | /** |
||
453 | * @return string |
||
454 | */ |
||
455 | public function getPropertyGUID() |
||
459 | |||
460 | /** |
||
461 | * @param string $PropertyGUID |
||
462 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
463 | */ |
||
464 | public function setPropertyGUID($PropertyGUID) |
||
469 | |||
470 | /** |
||
471 | * @return string |
||
472 | */ |
||
473 | public function getPropertyCode() |
||
477 | |||
478 | /** |
||
479 | * @param string $PropertyCode |
||
480 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
481 | */ |
||
482 | public function setPropertyCode($PropertyCode) |
||
487 | |||
488 | /** |
||
489 | * @return boolean |
||
490 | */ |
||
491 | public function getIsGuaranteed() |
||
495 | |||
496 | /** |
||
497 | * @param boolean $IsGuaranteed |
||
498 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
499 | */ |
||
500 | public function setIsGuaranteed($IsGuaranteed) |
||
505 | |||
506 | /** |
||
507 | * @return int |
||
508 | */ |
||
509 | public function getBookingCondoType() |
||
513 | |||
514 | /** |
||
515 | * @param int $BookingCondoType |
||
516 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
517 | */ |
||
518 | public function setBookingCondoType($BookingCondoType) |
||
523 | |||
524 | /** |
||
525 | * @return string |
||
526 | */ |
||
527 | public function getRoomNo() |
||
531 | |||
532 | /** |
||
533 | * @param string $RoomNo |
||
534 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
535 | */ |
||
536 | public function setRoomNo($RoomNo) |
||
541 | |||
542 | /** |
||
543 | * @return int |
||
544 | */ |
||
545 | public function getID_RoomTypeOcc() |
||
549 | |||
550 | /** |
||
551 | * @param int $ID_RoomTypeOcc |
||
552 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
553 | */ |
||
554 | public function setID_RoomTypeOcc($ID_RoomTypeOcc) |
||
559 | |||
560 | /** |
||
561 | * @return int |
||
562 | */ |
||
563 | public function getID_SuiteConfiguration() |
||
567 | |||
568 | /** |
||
569 | * @param int $ID_SuiteConfiguration |
||
570 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
571 | */ |
||
572 | public function setID_SuiteConfiguration($ID_SuiteConfiguration) |
||
577 | |||
578 | /** |
||
579 | * @return int |
||
580 | */ |
||
581 | public function getHSKRoomStatusType() |
||
585 | |||
586 | /** |
||
587 | * @param int $HSKRoomStatusType |
||
588 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
589 | */ |
||
590 | public function setHSKRoomStatusType($HSKRoomStatusType) |
||
595 | |||
596 | /** |
||
597 | * @return int |
||
598 | */ |
||
599 | public function getHSKRoomInspectionType() |
||
603 | |||
604 | /** |
||
605 | * @param int $HSKRoomInspectionType |
||
606 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
607 | */ |
||
608 | public function setHSKRoomInspectionType($HSKRoomInspectionType) |
||
613 | |||
614 | /** |
||
615 | * @return boolean |
||
616 | */ |
||
617 | public function getIsHSKRoomOccupied() |
||
621 | |||
622 | /** |
||
623 | * @param boolean $IsHSKRoomOccupied |
||
624 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
625 | */ |
||
626 | public function setIsHSKRoomOccupied($IsHSKRoomOccupied) |
||
631 | |||
632 | /** |
||
633 | * @return int |
||
634 | */ |
||
635 | public function getID_Member() |
||
639 | |||
640 | /** |
||
641 | * @param int $ID_Member |
||
642 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
643 | */ |
||
644 | public function setID_Member($ID_Member) |
||
649 | |||
650 | /** |
||
651 | * @return int |
||
652 | */ |
||
653 | public function getID_Admin() |
||
657 | |||
658 | /** |
||
659 | * @param int $ID_Admin |
||
660 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
661 | */ |
||
662 | public function setID_Admin($ID_Admin) |
||
667 | |||
668 | /** |
||
669 | * @return int |
||
670 | */ |
||
671 | public function getID_CondoOwner() |
||
675 | |||
676 | /** |
||
677 | * @param int $ID_CondoOwner |
||
678 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
679 | */ |
||
680 | public function setID_CondoOwner($ID_CondoOwner) |
||
685 | |||
686 | /** |
||
687 | * @return \DateTime |
||
688 | */ |
||
689 | public function getSystemCreationDate() |
||
701 | |||
702 | /** |
||
703 | * @param \DateTime $SystemCreationDate |
||
704 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
705 | */ |
||
706 | public function setSystemCreationDate(\DateTime $SystemCreationDate) |
||
711 | |||
712 | /** |
||
713 | * @return float |
||
714 | */ |
||
715 | public function getStayValue() |
||
719 | |||
720 | /** |
||
721 | * @param float $StayValue |
||
722 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
723 | */ |
||
724 | public function setStayValue($StayValue) |
||
729 | |||
730 | /** |
||
731 | * @return float |
||
732 | */ |
||
733 | public function getGrossRevenue() |
||
737 | |||
738 | /** |
||
739 | * @param float $GrossRevenue |
||
740 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
741 | */ |
||
742 | public function setGrossRevenue($GrossRevenue) |
||
747 | |||
748 | /** |
||
749 | * @return boolean |
||
750 | */ |
||
751 | public function getIsInternalReferal() |
||
755 | |||
756 | /** |
||
757 | * @param boolean $IsInternalReferal |
||
758 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
759 | */ |
||
760 | public function setIsInternalReferal($IsInternalReferal) |
||
765 | |||
766 | /** |
||
767 | * @return int |
||
768 | */ |
||
769 | public function getID_Referal() |
||
773 | |||
774 | /** |
||
775 | * @param int $ID_Referal |
||
776 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
777 | */ |
||
778 | public function setID_Referal($ID_Referal) |
||
783 | |||
784 | /** |
||
785 | * @return boolean |
||
786 | */ |
||
787 | public function getIsRBO() |
||
791 | |||
792 | /** |
||
793 | * @param boolean $IsRBO |
||
794 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
795 | */ |
||
796 | public function setIsRBO($IsRBO) |
||
801 | |||
802 | /** |
||
803 | * @return string |
||
804 | */ |
||
805 | public function getRateCodeName() |
||
809 | |||
810 | /** |
||
811 | * @param string $RateCodeName |
||
812 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
813 | */ |
||
814 | public function setRateCodeName($RateCodeName) |
||
819 | |||
820 | /** |
||
821 | * @return float |
||
822 | */ |
||
823 | public function getGrossRevenueTotal() |
||
827 | |||
828 | /** |
||
829 | * @param float $GrossRevenueTotal |
||
830 | * @return \Gueststream\PMS\IQWare\API\OwnerReservations |
||
831 | */ |
||
832 | public function setGrossRevenueTotal($GrossRevenueTotal) |
||
837 | } |
||
838 |
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..