Complex classes like TEntityPropertyType 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 TEntityPropertyType, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 11 | class TEntityPropertyType |
||
| 12 | { |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @property string $name |
||
| 16 | */ |
||
| 17 | private $name = null; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @property string $type |
||
| 21 | */ |
||
| 22 | private $type = null; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @property boolean $nullable |
||
| 26 | */ |
||
| 27 | private $nullable = null; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @property string $defaultValue |
||
| 31 | */ |
||
| 32 | private $defaultValue = null; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @property string $maxLength |
||
| 36 | */ |
||
| 37 | private $maxLength = null; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @property boolean $fixedLength |
||
| 41 | */ |
||
| 42 | private $fixedLength = null; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @property integer $precision |
||
| 46 | */ |
||
| 47 | private $precision = null; |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @property integer $scale |
||
| 51 | */ |
||
| 52 | private $scale = null; |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @property boolean $unicode |
||
| 56 | */ |
||
| 57 | private $unicode = null; |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @property string $collation |
||
| 61 | */ |
||
| 62 | private $collation = null; |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @property string $sRID |
||
| 66 | */ |
||
| 67 | private $sRID = null; |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @property string $concurrencyMode |
||
| 71 | */ |
||
| 72 | private $concurrencyMode = null; |
||
| 73 | |||
| 74 | /** |
||
| 75 | * @property string $setterAccess |
||
| 76 | */ |
||
| 77 | private $setterAccess = null; |
||
| 78 | |||
| 79 | /** |
||
| 80 | * @property string $getterAccess |
||
| 81 | */ |
||
| 82 | private $getterAccess = null; |
||
| 83 | |||
| 84 | /** |
||
| 85 | * @property string $storeGeneratedPattern |
||
| 86 | */ |
||
| 87 | private $storeGeneratedPattern = null; |
||
| 88 | |||
| 89 | /** |
||
| 90 | * @property \MetadataV3\edm\TDocumentationType[] $documentation |
||
| 91 | */ |
||
| 92 | private $documentation = array( |
||
| 93 | |||
| 94 | ); |
||
| 95 | |||
| 96 | /** |
||
| 97 | * @property \MetadataV3\edm\TValueAnnotationType[] $valueAnnotation |
||
| 98 | */ |
||
| 99 | private $valueAnnotation = array( |
||
| 100 | |||
| 101 | ); |
||
| 102 | |||
| 103 | /** |
||
| 104 | * @property \MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation |
||
| 105 | */ |
||
| 106 | private $typeAnnotation = array( |
||
| 107 | |||
| 108 | ); |
||
| 109 | |||
| 110 | /** |
||
| 111 | * Gets as name |
||
| 112 | * |
||
| 113 | * @return string |
||
| 114 | */ |
||
| 115 | public function getName() |
||
| 119 | |||
| 120 | /** |
||
| 121 | * Sets a new name |
||
| 122 | * |
||
| 123 | * @param string $name |
||
| 124 | * @return self |
||
| 125 | */ |
||
| 126 | public function setName($name) |
||
| 131 | |||
| 132 | /** |
||
| 133 | * Gets as type |
||
| 134 | * |
||
| 135 | * @return string |
||
| 136 | */ |
||
| 137 | public function getType() |
||
| 141 | |||
| 142 | /** |
||
| 143 | * Sets a new type |
||
| 144 | * |
||
| 145 | * @param string $type |
||
| 146 | * @return self |
||
| 147 | */ |
||
| 148 | public function setType($type) |
||
| 153 | |||
| 154 | /** |
||
| 155 | * Gets as nullable |
||
| 156 | * |
||
| 157 | * @return boolean |
||
| 158 | */ |
||
| 159 | public function getNullable() |
||
| 163 | |||
| 164 | /** |
||
| 165 | * Sets a new nullable |
||
| 166 | * |
||
| 167 | * @param boolean $nullable |
||
| 168 | * @return self |
||
| 169 | */ |
||
| 170 | public function setNullable($nullable) |
||
| 175 | |||
| 176 | /** |
||
| 177 | * Gets as defaultValue |
||
| 178 | * |
||
| 179 | * @return string |
||
| 180 | */ |
||
| 181 | public function getDefaultValue() |
||
| 185 | |||
| 186 | /** |
||
| 187 | * Sets a new defaultValue |
||
| 188 | * |
||
| 189 | * @param string $defaultValue |
||
| 190 | * @return self |
||
| 191 | */ |
||
| 192 | public function setDefaultValue($defaultValue) |
||
| 197 | |||
| 198 | /** |
||
| 199 | * Gets as maxLength |
||
| 200 | * |
||
| 201 | * @return string |
||
| 202 | */ |
||
| 203 | public function getMaxLength() |
||
| 207 | |||
| 208 | /** |
||
| 209 | * Sets a new maxLength |
||
| 210 | * |
||
| 211 | * @param string $maxLength |
||
| 212 | * @return self |
||
| 213 | */ |
||
| 214 | public function setMaxLength($maxLength) |
||
| 219 | |||
| 220 | /** |
||
| 221 | * Gets as fixedLength |
||
| 222 | * |
||
| 223 | * @return boolean |
||
| 224 | */ |
||
| 225 | public function getFixedLength() |
||
| 229 | |||
| 230 | /** |
||
| 231 | * Sets a new fixedLength |
||
| 232 | * |
||
| 233 | * @param boolean $fixedLength |
||
| 234 | * @return self |
||
| 235 | */ |
||
| 236 | public function setFixedLength($fixedLength) |
||
| 241 | |||
| 242 | /** |
||
| 243 | * Gets as precision |
||
| 244 | * |
||
| 245 | * @return integer |
||
| 246 | */ |
||
| 247 | public function getPrecision() |
||
| 251 | |||
| 252 | /** |
||
| 253 | * Sets a new precision |
||
| 254 | * |
||
| 255 | * @param integer $precision |
||
| 256 | * @return self |
||
| 257 | */ |
||
| 258 | public function setPrecision($precision) |
||
| 263 | |||
| 264 | /** |
||
| 265 | * Gets as scale |
||
| 266 | * |
||
| 267 | * @return integer |
||
| 268 | */ |
||
| 269 | public function getScale() |
||
| 273 | |||
| 274 | /** |
||
| 275 | * Sets a new scale |
||
| 276 | * |
||
| 277 | * @param integer $scale |
||
| 278 | * @return self |
||
| 279 | */ |
||
| 280 | public function setScale($scale) |
||
| 285 | |||
| 286 | /** |
||
| 287 | * Gets as unicode |
||
| 288 | * |
||
| 289 | * @return boolean |
||
| 290 | */ |
||
| 291 | public function getUnicode() |
||
| 295 | |||
| 296 | /** |
||
| 297 | * Sets a new unicode |
||
| 298 | * |
||
| 299 | * @param boolean $unicode |
||
| 300 | * @return self |
||
| 301 | */ |
||
| 302 | public function setUnicode($unicode) |
||
| 307 | |||
| 308 | /** |
||
| 309 | * Gets as collation |
||
| 310 | * |
||
| 311 | * @return string |
||
| 312 | */ |
||
| 313 | public function getCollation() |
||
| 317 | |||
| 318 | /** |
||
| 319 | * Sets a new collation |
||
| 320 | * |
||
| 321 | * @param string $collation |
||
| 322 | * @return self |
||
| 323 | */ |
||
| 324 | public function setCollation($collation) |
||
| 329 | |||
| 330 | /** |
||
| 331 | * Gets as sRID |
||
| 332 | * |
||
| 333 | * @return string |
||
| 334 | */ |
||
| 335 | public function getSRID() |
||
| 339 | |||
| 340 | /** |
||
| 341 | * Sets a new sRID |
||
| 342 | * |
||
| 343 | * @param string $sRID |
||
| 344 | * @return self |
||
| 345 | */ |
||
| 346 | public function setSRID($sRID) |
||
| 351 | |||
| 352 | /** |
||
| 353 | * Gets as concurrencyMode |
||
| 354 | * |
||
| 355 | * @return string |
||
| 356 | */ |
||
| 357 | public function getConcurrencyMode() |
||
| 361 | |||
| 362 | /** |
||
| 363 | * Sets a new concurrencyMode |
||
| 364 | * |
||
| 365 | * @param string $concurrencyMode |
||
| 366 | * @return self |
||
| 367 | */ |
||
| 368 | public function setConcurrencyMode($concurrencyMode) |
||
| 373 | |||
| 374 | /** |
||
| 375 | * Gets as setterAccess |
||
| 376 | * |
||
| 377 | * @return string |
||
| 378 | */ |
||
| 379 | public function getSetterAccess() |
||
| 383 | |||
| 384 | /** |
||
| 385 | * Sets a new setterAccess |
||
| 386 | * |
||
| 387 | * @param string $setterAccess |
||
| 388 | * @return self |
||
| 389 | */ |
||
| 390 | public function setSetterAccess($setterAccess) |
||
| 395 | |||
| 396 | /** |
||
| 397 | * Gets as getterAccess |
||
| 398 | * |
||
| 399 | * @return string |
||
| 400 | */ |
||
| 401 | public function getGetterAccess() |
||
| 405 | |||
| 406 | /** |
||
| 407 | * Sets a new getterAccess |
||
| 408 | * |
||
| 409 | * @param string $getterAccess |
||
| 410 | * @return self |
||
| 411 | */ |
||
| 412 | public function setGetterAccess($getterAccess) |
||
| 417 | |||
| 418 | /** |
||
| 419 | * Gets as storeGeneratedPattern |
||
| 420 | * |
||
| 421 | * @return string |
||
| 422 | */ |
||
| 423 | public function getStoreGeneratedPattern() |
||
| 427 | |||
| 428 | /** |
||
| 429 | * Sets a new storeGeneratedPattern |
||
| 430 | * |
||
| 431 | * @param string $storeGeneratedPattern |
||
| 432 | * @return self |
||
| 433 | */ |
||
| 434 | public function setStoreGeneratedPattern($storeGeneratedPattern) |
||
| 439 | |||
| 440 | /** |
||
| 441 | * Adds as documentation |
||
| 442 | * |
||
| 443 | * @return self |
||
| 444 | * @param \MetadataV3\edm\TDocumentationType $documentation |
||
| 445 | */ |
||
| 446 | public function addToDocumentation(\MetadataV3\edm\TDocumentationType $documentation) |
||
| 451 | |||
| 452 | /** |
||
| 453 | * isset documentation |
||
| 454 | * |
||
| 455 | * @param scalar $index |
||
| 456 | * @return boolean |
||
| 457 | */ |
||
| 458 | public function issetDocumentation($index) |
||
| 462 | |||
| 463 | /** |
||
| 464 | * unset documentation |
||
| 465 | * |
||
| 466 | * @param scalar $index |
||
| 467 | * @return void |
||
| 468 | */ |
||
| 469 | public function unsetDocumentation($index) |
||
| 473 | |||
| 474 | /** |
||
| 475 | * Gets as documentation |
||
| 476 | * |
||
| 477 | * @return \MetadataV3\edm\TDocumentationType[] |
||
| 478 | */ |
||
| 479 | public function getDocumentation() |
||
| 483 | |||
| 484 | /** |
||
| 485 | * Sets a new documentation |
||
| 486 | * |
||
| 487 | * @param \MetadataV3\edm\TDocumentationType[] $documentation |
||
| 488 | * @return self |
||
| 489 | */ |
||
| 490 | public function setDocumentation(array $documentation) |
||
| 495 | |||
| 496 | /** |
||
| 497 | * Adds as valueAnnotation |
||
| 498 | * |
||
| 499 | * @return self |
||
| 500 | * @param \MetadataV3\edm\TValueAnnotationType $valueAnnotation |
||
| 501 | */ |
||
| 502 | public function addToValueAnnotation(\MetadataV3\edm\TValueAnnotationType $valueAnnotation) |
||
| 507 | |||
| 508 | /** |
||
| 509 | * isset valueAnnotation |
||
| 510 | * |
||
| 511 | * @param scalar $index |
||
| 512 | * @return boolean |
||
| 513 | */ |
||
| 514 | public function issetValueAnnotation($index) |
||
| 518 | |||
| 519 | /** |
||
| 520 | * unset valueAnnotation |
||
| 521 | * |
||
| 522 | * @param scalar $index |
||
| 523 | * @return void |
||
| 524 | */ |
||
| 525 | public function unsetValueAnnotation($index) |
||
| 529 | |||
| 530 | /** |
||
| 531 | * Gets as valueAnnotation |
||
| 532 | * |
||
| 533 | * @return \MetadataV3\edm\TValueAnnotationType[] |
||
| 534 | */ |
||
| 535 | public function getValueAnnotation() |
||
| 539 | |||
| 540 | /** |
||
| 541 | * Sets a new valueAnnotation |
||
| 542 | * |
||
| 543 | * @param \MetadataV3\edm\TValueAnnotationType[] $valueAnnotation |
||
| 544 | * @return self |
||
| 545 | */ |
||
| 546 | public function setValueAnnotation(array $valueAnnotation) |
||
| 551 | |||
| 552 | /** |
||
| 553 | * Adds as typeAnnotation |
||
| 554 | * |
||
| 555 | * @return self |
||
| 556 | * @param \MetadataV3\edm\TTypeAnnotationType $typeAnnotation |
||
| 557 | */ |
||
| 558 | public function addToTypeAnnotation(\MetadataV3\edm\TTypeAnnotationType $typeAnnotation) |
||
| 563 | |||
| 564 | /** |
||
| 565 | * isset typeAnnotation |
||
| 566 | * |
||
| 567 | * @param scalar $index |
||
| 568 | * @return boolean |
||
| 569 | */ |
||
| 570 | public function issetTypeAnnotation($index) |
||
| 574 | |||
| 575 | /** |
||
| 576 | * unset typeAnnotation |
||
| 577 | * |
||
| 578 | * @param scalar $index |
||
| 579 | * @return void |
||
| 580 | */ |
||
| 581 | public function unsetTypeAnnotation($index) |
||
| 585 | |||
| 586 | /** |
||
| 587 | * Gets as typeAnnotation |
||
| 588 | * |
||
| 589 | * @return \MetadataV3\edm\TTypeAnnotationType[] |
||
| 590 | */ |
||
| 591 | public function getTypeAnnotation() |
||
| 595 | |||
| 596 | /** |
||
| 597 | * Sets a new typeAnnotation |
||
| 598 | * |
||
| 599 | * @param \MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation |
||
| 600 | * @return self |
||
| 601 | */ |
||
| 602 | public function setTypeAnnotation(array $typeAnnotation) |
||
| 607 | } |
||
| 608 |