Complex classes like GetRatesAndRoomsPricesBackToBack 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 GetRatesAndRoomsPricesBackToBack, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 5 | class GetRatesAndRoomsPricesBackToBack |
||
| 6 | { |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @var ArrayOfInt $iGuids |
||
| 10 | */ |
||
| 11 | protected $iGuids = null; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var \DateTime $dtArrivalDate |
||
| 15 | */ |
||
| 16 | protected $dtArrivalDate = null; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var \DateTime $dtDepartureDate |
||
| 20 | */ |
||
| 21 | protected $dtDepartureDate = null; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var int $intGuestCount |
||
| 25 | */ |
||
| 26 | protected $intGuestCount = null; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var string $strChildrens |
||
| 30 | */ |
||
| 31 | protected $strChildrens = null; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var string $strISOLanguageCode |
||
| 35 | */ |
||
| 36 | protected $strISOLanguageCode = null; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var int $intID_AccommodationType |
||
| 40 | */ |
||
| 41 | protected $intID_AccommodationType = null; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @var int $intRoomQty |
||
| 45 | */ |
||
| 46 | protected $intRoomQty = null; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @var string $strListOfPromoRates |
||
| 50 | */ |
||
| 51 | protected $strListOfPromoRates = null; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @var boolean $IsPromoByRate |
||
| 55 | */ |
||
| 56 | protected $IsPromoByRate = null; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @var int $intRateSpecial |
||
| 60 | */ |
||
| 61 | protected $intRateSpecial = null; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @var string $strAttributes |
||
| 65 | */ |
||
| 66 | protected $strAttributes = null; |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @var string $strLocations |
||
| 70 | */ |
||
| 71 | protected $strLocations = null; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @var string $strRateCodes |
||
| 75 | */ |
||
| 76 | protected $strRateCodes = null; |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @var string $strRoomTypes |
||
| 80 | */ |
||
| 81 | protected $strRoomTypes = null; |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @var string $strBuildings |
||
| 85 | */ |
||
| 86 | protected $strBuildings = null; |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @var string $strBeddingIDs |
||
| 90 | */ |
||
| 91 | protected $strBeddingIDs = null; |
||
| 92 | |||
| 93 | /** |
||
| 94 | * @var string $strAttributeGroupings |
||
| 95 | */ |
||
| 96 | protected $strAttributeGroupings = null; |
||
| 97 | |||
| 98 | /** |
||
| 99 | * @var string $strLocationsGroupings |
||
| 100 | */ |
||
| 101 | protected $strLocationsGroupings = null; |
||
| 102 | |||
| 103 | /** |
||
| 104 | * @var IAB2BMode $BackToBackMode |
||
| 105 | */ |
||
| 106 | protected $BackToBackMode = null; |
||
| 107 | |||
| 108 | /** |
||
| 109 | * @var boolean $IsClusterVersion |
||
| 110 | */ |
||
| 111 | protected $IsClusterVersion = null; |
||
| 112 | |||
| 113 | /** |
||
| 114 | * @param ArrayOfInt $iGuids |
||
| 115 | * @param \DateTime $dtArrivalDate |
||
| 116 | * @param \DateTime $dtDepartureDate |
||
| 117 | * @param int $intGuestCount |
||
| 118 | * @param string $strChildrens |
||
| 119 | * @param string $strISOLanguageCode |
||
| 120 | * @param int $intID_AccommodationType |
||
| 121 | * @param int $intRoomQty |
||
| 122 | * @param string $strListOfPromoRates |
||
| 123 | * @param boolean $IsPromoByRate |
||
| 124 | * @param int $intRateSpecial |
||
| 125 | * @param string $strAttributes |
||
| 126 | * @param string $strLocations |
||
| 127 | * @param string $strRateCodes |
||
| 128 | * @param string $strRoomTypes |
||
| 129 | * @param string $strBuildings |
||
| 130 | * @param string $strBeddingIDs |
||
| 131 | * @param string $strAttributeGroupings |
||
| 132 | * @param string $strLocationsGroupings |
||
| 133 | * @param IAB2BMode $BackToBackMode |
||
| 134 | * @param boolean $IsClusterVersion |
||
| 135 | */ |
||
| 136 | public function __construct($iGuids, \DateTime $dtArrivalDate, \DateTime $dtDepartureDate, $intGuestCount, $strChildrens, $strISOLanguageCode, $intID_AccommodationType, $intRoomQty, $strListOfPromoRates, $IsPromoByRate, $intRateSpecial, $strAttributes, $strLocations, $strRateCodes, $strRoomTypes, $strBuildings, $strBeddingIDs, $strAttributeGroupings, $strLocationsGroupings, $BackToBackMode, $IsClusterVersion) |
||
| 160 | |||
| 161 | /** |
||
| 162 | * @return ArrayOfInt |
||
| 163 | */ |
||
| 164 | public function getIGuids() |
||
| 168 | |||
| 169 | /** |
||
| 170 | * @param ArrayOfInt $iGuids |
||
| 171 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 172 | */ |
||
| 173 | public function setIGuids($iGuids) |
||
| 178 | |||
| 179 | /** |
||
| 180 | * @return \DateTime |
||
| 181 | */ |
||
| 182 | public function getDtArrivalDate() |
||
| 194 | |||
| 195 | /** |
||
| 196 | * @param \DateTime $dtArrivalDate |
||
| 197 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 198 | */ |
||
| 199 | public function setDtArrivalDate(\DateTime $dtArrivalDate) |
||
| 204 | |||
| 205 | /** |
||
| 206 | * @return \DateTime |
||
| 207 | */ |
||
| 208 | public function getDtDepartureDate() |
||
| 220 | |||
| 221 | /** |
||
| 222 | * @param \DateTime $dtDepartureDate |
||
| 223 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 224 | */ |
||
| 225 | public function setDtDepartureDate(\DateTime $dtDepartureDate) |
||
| 230 | |||
| 231 | /** |
||
| 232 | * @return int |
||
| 233 | */ |
||
| 234 | public function getIntGuestCount() |
||
| 238 | |||
| 239 | /** |
||
| 240 | * @param int $intGuestCount |
||
| 241 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 242 | */ |
||
| 243 | public function setIntGuestCount($intGuestCount) |
||
| 248 | |||
| 249 | /** |
||
| 250 | * @return string |
||
| 251 | */ |
||
| 252 | public function getStrChildrens() |
||
| 256 | |||
| 257 | /** |
||
| 258 | * @param string $strChildrens |
||
| 259 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 260 | */ |
||
| 261 | public function setStrChildrens($strChildrens) |
||
| 266 | |||
| 267 | /** |
||
| 268 | * @return string |
||
| 269 | */ |
||
| 270 | public function getStrISOLanguageCode() |
||
| 274 | |||
| 275 | /** |
||
| 276 | * @param string $strISOLanguageCode |
||
| 277 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 278 | */ |
||
| 279 | public function setStrISOLanguageCode($strISOLanguageCode) |
||
| 284 | |||
| 285 | /** |
||
| 286 | * @return int |
||
| 287 | */ |
||
| 288 | public function getIntID_AccommodationType() |
||
| 292 | |||
| 293 | /** |
||
| 294 | * @param int $intID_AccommodationType |
||
| 295 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 296 | */ |
||
| 297 | public function setIntID_AccommodationType($intID_AccommodationType) |
||
| 302 | |||
| 303 | /** |
||
| 304 | * @return int |
||
| 305 | */ |
||
| 306 | public function getIntRoomQty() |
||
| 310 | |||
| 311 | /** |
||
| 312 | * @param int $intRoomQty |
||
| 313 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 314 | */ |
||
| 315 | public function setIntRoomQty($intRoomQty) |
||
| 320 | |||
| 321 | /** |
||
| 322 | * @return string |
||
| 323 | */ |
||
| 324 | public function getStrListOfPromoRates() |
||
| 328 | |||
| 329 | /** |
||
| 330 | * @param string $strListOfPromoRates |
||
| 331 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 332 | */ |
||
| 333 | public function setStrListOfPromoRates($strListOfPromoRates) |
||
| 338 | |||
| 339 | /** |
||
| 340 | * @return boolean |
||
| 341 | */ |
||
| 342 | public function getIsPromoByRate() |
||
| 346 | |||
| 347 | /** |
||
| 348 | * @param boolean $IsPromoByRate |
||
| 349 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 350 | */ |
||
| 351 | public function setIsPromoByRate($IsPromoByRate) |
||
| 356 | |||
| 357 | /** |
||
| 358 | * @return int |
||
| 359 | */ |
||
| 360 | public function getIntRateSpecial() |
||
| 364 | |||
| 365 | /** |
||
| 366 | * @param int $intRateSpecial |
||
| 367 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 368 | */ |
||
| 369 | public function setIntRateSpecial($intRateSpecial) |
||
| 374 | |||
| 375 | /** |
||
| 376 | * @return string |
||
| 377 | */ |
||
| 378 | public function getStrAttributes() |
||
| 382 | |||
| 383 | /** |
||
| 384 | * @param string $strAttributes |
||
| 385 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 386 | */ |
||
| 387 | public function setStrAttributes($strAttributes) |
||
| 392 | |||
| 393 | /** |
||
| 394 | * @return string |
||
| 395 | */ |
||
| 396 | public function getStrLocations() |
||
| 400 | |||
| 401 | /** |
||
| 402 | * @param string $strLocations |
||
| 403 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 404 | */ |
||
| 405 | public function setStrLocations($strLocations) |
||
| 410 | |||
| 411 | /** |
||
| 412 | * @return string |
||
| 413 | */ |
||
| 414 | public function getStrRateCodes() |
||
| 418 | |||
| 419 | /** |
||
| 420 | * @param string $strRateCodes |
||
| 421 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 422 | */ |
||
| 423 | public function setStrRateCodes($strRateCodes) |
||
| 428 | |||
| 429 | /** |
||
| 430 | * @return string |
||
| 431 | */ |
||
| 432 | public function getStrRoomTypes() |
||
| 436 | |||
| 437 | /** |
||
| 438 | * @param string $strRoomTypes |
||
| 439 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 440 | */ |
||
| 441 | public function setStrRoomTypes($strRoomTypes) |
||
| 446 | |||
| 447 | /** |
||
| 448 | * @return string |
||
| 449 | */ |
||
| 450 | public function getStrBuildings() |
||
| 454 | |||
| 455 | /** |
||
| 456 | * @param string $strBuildings |
||
| 457 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 458 | */ |
||
| 459 | public function setStrBuildings($strBuildings) |
||
| 464 | |||
| 465 | /** |
||
| 466 | * @return string |
||
| 467 | */ |
||
| 468 | public function getStrBeddingIDs() |
||
| 472 | |||
| 473 | /** |
||
| 474 | * @param string $strBeddingIDs |
||
| 475 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 476 | */ |
||
| 477 | public function setStrBeddingIDs($strBeddingIDs) |
||
| 482 | |||
| 483 | /** |
||
| 484 | * @return string |
||
| 485 | */ |
||
| 486 | public function getStrAttributeGroupings() |
||
| 490 | |||
| 491 | /** |
||
| 492 | * @param string $strAttributeGroupings |
||
| 493 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 494 | */ |
||
| 495 | public function setStrAttributeGroupings($strAttributeGroupings) |
||
| 500 | |||
| 501 | /** |
||
| 502 | * @return string |
||
| 503 | */ |
||
| 504 | public function getStrLocationsGroupings() |
||
| 508 | |||
| 509 | /** |
||
| 510 | * @param string $strLocationsGroupings |
||
| 511 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 512 | */ |
||
| 513 | public function setStrLocationsGroupings($strLocationsGroupings) |
||
| 518 | |||
| 519 | /** |
||
| 520 | * @return IAB2BMode |
||
| 521 | */ |
||
| 522 | public function getBackToBackMode() |
||
| 526 | |||
| 527 | /** |
||
| 528 | * @param IAB2BMode $BackToBackMode |
||
| 529 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 530 | */ |
||
| 531 | public function setBackToBackMode($BackToBackMode) |
||
| 536 | |||
| 537 | /** |
||
| 538 | * @return boolean |
||
| 539 | */ |
||
| 540 | public function getIsClusterVersion() |
||
| 544 | |||
| 545 | /** |
||
| 546 | * @param boolean $IsClusterVersion |
||
| 547 | * @return \Gueststream\PMS\IQWare\API\GetRatesAndRoomsPricesBackToBack |
||
| 548 | */ |
||
| 549 | public function setIsClusterVersion($IsClusterVersion) |
||
| 554 | } |
||
| 555 |
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..