Complex classes like BeachChairGetSingleStayValue 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 BeachChairGetSingleStayValue, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 5 | class BeachChairGetSingleStayValue |
||
| 6 | { |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @var int $intGUID |
||
| 10 | */ |
||
| 11 | protected $intGUID = null; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var string $strISOLanguage |
||
| 15 | */ |
||
| 16 | protected $strISOLanguage = null; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var int $intRoomType |
||
| 20 | */ |
||
| 21 | protected $intRoomType = null; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var int $intRateID |
||
| 25 | */ |
||
| 26 | protected $intRateID = null; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var string $strRateSpecial |
||
| 30 | */ |
||
| 31 | protected $strRateSpecial = null; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var int $intGuestCount |
||
| 35 | */ |
||
| 36 | protected $intGuestCount = null; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var string $strChildren |
||
| 40 | */ |
||
| 41 | protected $strChildren = null; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @var \DateTime $dArrDate |
||
| 45 | */ |
||
| 46 | protected $dArrDate = null; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @var \DateTime $dDepDate |
||
| 50 | */ |
||
| 51 | protected $dDepDate = null; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @var string $strAttributes |
||
| 55 | */ |
||
| 56 | protected $strAttributes = null; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @var string $strLocations |
||
| 60 | */ |
||
| 61 | protected $strLocations = null; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @var ArrayOfElements $ListElements |
||
| 65 | */ |
||
| 66 | protected $ListElements = null; |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @var int $intRoomQty |
||
| 70 | */ |
||
| 71 | protected $intRoomQty = null; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @var boolean $IsInsuranceAccepted |
||
| 75 | */ |
||
| 76 | protected $IsInsuranceAccepted = null; |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @var string $strAttributeGroupings |
||
| 80 | */ |
||
| 81 | protected $strAttributeGroupings = null; |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @var string $strLocationsGroupings |
||
| 85 | */ |
||
| 86 | protected $strLocationsGroupings = null; |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @var int $intBusinessSourceID |
||
| 90 | */ |
||
| 91 | protected $intBusinessSourceID = null; |
||
| 92 | |||
| 93 | /** |
||
| 94 | * @var ArrayOfActivityUnit $ListActivityUnits |
||
| 95 | */ |
||
| 96 | protected $ListActivityUnits = null; |
||
| 97 | |||
| 98 | /** |
||
| 99 | * @var int $ID_ActivityToken |
||
| 100 | */ |
||
| 101 | protected $ID_ActivityToken = null; |
||
| 102 | |||
| 103 | /** |
||
| 104 | * @param int $intGUID |
||
| 105 | * @param string $strISOLanguage |
||
| 106 | * @param int $intRoomType |
||
| 107 | * @param int $intRateID |
||
| 108 | * @param string $strRateSpecial |
||
| 109 | * @param int $intGuestCount |
||
| 110 | * @param string $strChildren |
||
| 111 | * @param \DateTime $dArrDate |
||
| 112 | * @param \DateTime $dDepDate |
||
| 113 | * @param string $strAttributes |
||
| 114 | * @param string $strLocations |
||
| 115 | * @param ArrayOfElements $ListElements |
||
| 116 | * @param int $intRoomQty |
||
| 117 | * @param boolean $IsInsuranceAccepted |
||
| 118 | * @param string $strAttributeGroupings |
||
| 119 | * @param string $strLocationsGroupings |
||
| 120 | * @param int $intBusinessSourceID |
||
| 121 | * @param ArrayOfActivityUnit $ListActivityUnits |
||
| 122 | * @param int $ID_ActivityToken |
||
| 123 | */ |
||
| 124 | public function __construct($intGUID, $strISOLanguage, $intRoomType, $intRateID, $strRateSpecial, $intGuestCount, $strChildren, \DateTime $dArrDate, \DateTime $dDepDate, $strAttributes, $strLocations, $ListElements, $intRoomQty, $IsInsuranceAccepted, $strAttributeGroupings, $strLocationsGroupings, $intBusinessSourceID, $ListActivityUnits, $ID_ActivityToken) |
||
| 146 | |||
| 147 | /** |
||
| 148 | * @return int |
||
| 149 | */ |
||
| 150 | public function getIntGUID() |
||
| 154 | |||
| 155 | /** |
||
| 156 | * @param int $intGUID |
||
| 157 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 158 | */ |
||
| 159 | public function setIntGUID($intGUID) |
||
| 164 | |||
| 165 | /** |
||
| 166 | * @return string |
||
| 167 | */ |
||
| 168 | public function getStrISOLanguage() |
||
| 172 | |||
| 173 | /** |
||
| 174 | * @param string $strISOLanguage |
||
| 175 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 176 | */ |
||
| 177 | public function setStrISOLanguage($strISOLanguage) |
||
| 182 | |||
| 183 | /** |
||
| 184 | * @return int |
||
| 185 | */ |
||
| 186 | public function getIntRoomType() |
||
| 190 | |||
| 191 | /** |
||
| 192 | * @param int $intRoomType |
||
| 193 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 194 | */ |
||
| 195 | public function setIntRoomType($intRoomType) |
||
| 200 | |||
| 201 | /** |
||
| 202 | * @return int |
||
| 203 | */ |
||
| 204 | public function getIntRateID() |
||
| 208 | |||
| 209 | /** |
||
| 210 | * @param int $intRateID |
||
| 211 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 212 | */ |
||
| 213 | public function setIntRateID($intRateID) |
||
| 218 | |||
| 219 | /** |
||
| 220 | * @return string |
||
| 221 | */ |
||
| 222 | public function getStrRateSpecial() |
||
| 226 | |||
| 227 | /** |
||
| 228 | * @param string $strRateSpecial |
||
| 229 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 230 | */ |
||
| 231 | public function setStrRateSpecial($strRateSpecial) |
||
| 236 | |||
| 237 | /** |
||
| 238 | * @return int |
||
| 239 | */ |
||
| 240 | public function getIntGuestCount() |
||
| 244 | |||
| 245 | /** |
||
| 246 | * @param int $intGuestCount |
||
| 247 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 248 | */ |
||
| 249 | public function setIntGuestCount($intGuestCount) |
||
| 254 | |||
| 255 | /** |
||
| 256 | * @return string |
||
| 257 | */ |
||
| 258 | public function getStrChildren() |
||
| 262 | |||
| 263 | /** |
||
| 264 | * @param string $strChildren |
||
| 265 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 266 | */ |
||
| 267 | public function setStrChildren($strChildren) |
||
| 272 | |||
| 273 | /** |
||
| 274 | * @return \DateTime |
||
| 275 | */ |
||
| 276 | public function getDArrDate() |
||
| 288 | |||
| 289 | /** |
||
| 290 | * @param \DateTime $dArrDate |
||
| 291 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 292 | */ |
||
| 293 | public function setDArrDate(\DateTime $dArrDate) |
||
| 298 | |||
| 299 | /** |
||
| 300 | * @return \DateTime |
||
| 301 | */ |
||
| 302 | public function getDDepDate() |
||
| 314 | |||
| 315 | /** |
||
| 316 | * @param \DateTime $dDepDate |
||
| 317 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 318 | */ |
||
| 319 | public function setDDepDate(\DateTime $dDepDate) |
||
| 324 | |||
| 325 | /** |
||
| 326 | * @return string |
||
| 327 | */ |
||
| 328 | public function getStrAttributes() |
||
| 332 | |||
| 333 | /** |
||
| 334 | * @param string $strAttributes |
||
| 335 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 336 | */ |
||
| 337 | public function setStrAttributes($strAttributes) |
||
| 342 | |||
| 343 | /** |
||
| 344 | * @return string |
||
| 345 | */ |
||
| 346 | public function getStrLocations() |
||
| 350 | |||
| 351 | /** |
||
| 352 | * @param string $strLocations |
||
| 353 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 354 | */ |
||
| 355 | public function setStrLocations($strLocations) |
||
| 360 | |||
| 361 | /** |
||
| 362 | * @return ArrayOfElements |
||
| 363 | */ |
||
| 364 | public function getListElements() |
||
| 368 | |||
| 369 | /** |
||
| 370 | * @param ArrayOfElements $ListElements |
||
| 371 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 372 | */ |
||
| 373 | public function setListElements($ListElements) |
||
| 378 | |||
| 379 | /** |
||
| 380 | * @return int |
||
| 381 | */ |
||
| 382 | public function getIntRoomQty() |
||
| 386 | |||
| 387 | /** |
||
| 388 | * @param int $intRoomQty |
||
| 389 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 390 | */ |
||
| 391 | public function setIntRoomQty($intRoomQty) |
||
| 396 | |||
| 397 | /** |
||
| 398 | * @return boolean |
||
| 399 | */ |
||
| 400 | public function getIsInsuranceAccepted() |
||
| 404 | |||
| 405 | /** |
||
| 406 | * @param boolean $IsInsuranceAccepted |
||
| 407 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 408 | */ |
||
| 409 | public function setIsInsuranceAccepted($IsInsuranceAccepted) |
||
| 414 | |||
| 415 | /** |
||
| 416 | * @return string |
||
| 417 | */ |
||
| 418 | public function getStrAttributeGroupings() |
||
| 422 | |||
| 423 | /** |
||
| 424 | * @param string $strAttributeGroupings |
||
| 425 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 426 | */ |
||
| 427 | public function setStrAttributeGroupings($strAttributeGroupings) |
||
| 432 | |||
| 433 | /** |
||
| 434 | * @return string |
||
| 435 | */ |
||
| 436 | public function getStrLocationsGroupings() |
||
| 440 | |||
| 441 | /** |
||
| 442 | * @param string $strLocationsGroupings |
||
| 443 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 444 | */ |
||
| 445 | public function setStrLocationsGroupings($strLocationsGroupings) |
||
| 450 | |||
| 451 | /** |
||
| 452 | * @return int |
||
| 453 | */ |
||
| 454 | public function getIntBusinessSourceID() |
||
| 458 | |||
| 459 | /** |
||
| 460 | * @param int $intBusinessSourceID |
||
| 461 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 462 | */ |
||
| 463 | public function setIntBusinessSourceID($intBusinessSourceID) |
||
| 468 | |||
| 469 | /** |
||
| 470 | * @return ArrayOfActivityUnit |
||
| 471 | */ |
||
| 472 | public function getListActivityUnits() |
||
| 476 | |||
| 477 | /** |
||
| 478 | * @param ArrayOfActivityUnit $ListActivityUnits |
||
| 479 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 480 | */ |
||
| 481 | public function setListActivityUnits($ListActivityUnits) |
||
| 486 | |||
| 487 | /** |
||
| 488 | * @return int |
||
| 489 | */ |
||
| 490 | public function getID_ActivityToken() |
||
| 494 | |||
| 495 | /** |
||
| 496 | * @param int $ID_ActivityToken |
||
| 497 | * @return \Gueststream\PMS\IQWare\API\BeachChairGetSingleStayValue |
||
| 498 | */ |
||
| 499 | public function setID_ActivityToken($ID_ActivityToken) |
||
| 504 | } |
||
| 505 |
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..