Complex classes like SslCheckerResult 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 SslCheckerResult, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 7 | class SslCheckerResult extends AbstractResult |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var string |
||
| 11 | */ |
||
| 12 | protected $serverUrl; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | protected $serverDomainIsIDN; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | protected $serverDomainUtf8; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var string |
||
| 26 | */ |
||
| 27 | protected $serverDomainAce; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var string |
||
| 31 | */ |
||
| 32 | protected $serverIp; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @var integer |
||
| 36 | */ |
||
| 37 | protected $serverPort; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @var string |
||
| 41 | */ |
||
| 42 | protected $serverSoftware; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @var \DateTime |
||
| 46 | */ |
||
| 47 | protected $certNotBefore; |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @var \DateTime |
||
| 51 | */ |
||
| 52 | protected $certNotAfter; |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @var string |
||
| 56 | */ |
||
| 57 | protected $certValidityNotBefore; |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @var string |
||
| 61 | */ |
||
| 62 | protected $certValidityNotAfter; |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @var string |
||
| 66 | */ |
||
| 67 | protected $certKeyAlgorithm; |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @var string |
||
| 71 | */ |
||
| 72 | protected $certKeySize; |
||
| 73 | |||
| 74 | /** |
||
| 75 | * @var string |
||
| 76 | */ |
||
| 77 | protected $certSubjectDN; |
||
| 78 | |||
| 79 | /** |
||
| 80 | * @var string |
||
| 81 | */ |
||
| 82 | protected $certSubjectCN; |
||
| 83 | |||
| 84 | /** |
||
| 85 | * @var string |
||
| 86 | */ |
||
| 87 | protected $certSubjectOU; |
||
| 88 | |||
| 89 | /** |
||
| 90 | * @var string |
||
| 91 | */ |
||
| 92 | protected $certSubjectOrganization; |
||
| 93 | |||
| 94 | /** |
||
| 95 | * @var string |
||
| 96 | */ |
||
| 97 | protected $certSubjectStreetAddress1; |
||
| 98 | |||
| 99 | /** |
||
| 100 | * @var string |
||
| 101 | */ |
||
| 102 | protected $certSubjectStreetAddress2; |
||
| 103 | |||
| 104 | /** |
||
| 105 | * @var string |
||
| 106 | */ |
||
| 107 | protected $certSubjectStreetAddress3; |
||
| 108 | |||
| 109 | /** |
||
| 110 | * @var string |
||
| 111 | */ |
||
| 112 | protected $certSubjectLocality; |
||
| 113 | |||
| 114 | /** |
||
| 115 | * @var string |
||
| 116 | */ |
||
| 117 | protected $certSubjectState; |
||
| 118 | |||
| 119 | /** |
||
| 120 | * @var string |
||
| 121 | */ |
||
| 122 | protected $certSubjectPostalCode ; |
||
| 123 | |||
| 124 | /** |
||
| 125 | * @var string |
||
| 126 | */ |
||
| 127 | protected $certSubjectCountry ; |
||
| 128 | |||
| 129 | /** |
||
| 130 | * @var string |
||
| 131 | */ |
||
| 132 | protected $certIsMultiDomain; |
||
| 133 | |||
| 134 | /** |
||
| 135 | * @var string |
||
| 136 | */ |
||
| 137 | protected $certIsWildcard; |
||
| 138 | |||
| 139 | /** |
||
| 140 | * @var string |
||
| 141 | */ |
||
| 142 | protected $certIssuerDN; |
||
| 143 | |||
| 144 | /** |
||
| 145 | * @var string |
||
| 146 | */ |
||
| 147 | protected $certIssuerCN; |
||
| 148 | |||
| 149 | /** |
||
| 150 | * @var string |
||
| 151 | */ |
||
| 152 | protected $certIssuerOrganization; |
||
| 153 | |||
| 154 | /** |
||
| 155 | * @var string |
||
| 156 | */ |
||
| 157 | protected $certIssuerCountry; |
||
| 158 | |||
| 159 | /** |
||
| 160 | * @var string |
||
| 161 | */ |
||
| 162 | protected $certIssuerBrand; |
||
| 163 | |||
| 164 | /** |
||
| 165 | * @var string |
||
| 166 | */ |
||
| 167 | protected $certPolicyOID; |
||
| 168 | |||
| 169 | /** |
||
| 170 | * @var string |
||
| 171 | */ |
||
| 172 | protected $certValidation; |
||
| 173 | |||
| 174 | /** |
||
| 175 | * @return string |
||
| 176 | */ |
||
| 177 | public function getServerUrl() |
||
| 181 | |||
| 182 | /** |
||
| 183 | * @param string $serverUrl |
||
| 184 | * @return SslCheckerResult |
||
| 185 | */ |
||
| 186 | public function setServerUrl($serverUrl) |
||
| 191 | |||
| 192 | /** |
||
| 193 | * @return string |
||
| 194 | */ |
||
| 195 | public function getServerDomainIsIDN() |
||
| 199 | |||
| 200 | /** |
||
| 201 | * @param string $serverDomainIsIDN |
||
| 202 | * @return SslCheckerResult |
||
| 203 | */ |
||
| 204 | public function setServerDomainIsIDN($serverDomainIsIDN) |
||
| 209 | |||
| 210 | /** |
||
| 211 | * @return string |
||
| 212 | */ |
||
| 213 | public function getServerDomainUtf8() |
||
| 217 | |||
| 218 | /** |
||
| 219 | * @param string $serverDomainUtf8 |
||
| 220 | * @return SslCheckerResult |
||
| 221 | */ |
||
| 222 | public function setServerDomainUtf8($serverDomainUtf8) |
||
| 227 | |||
| 228 | /** |
||
| 229 | * @return string |
||
| 230 | */ |
||
| 231 | public function getServerDomainAce() |
||
| 235 | |||
| 236 | /** |
||
| 237 | * @param string $serverDomainAce |
||
| 238 | * @return SslCheckerResult |
||
| 239 | */ |
||
| 240 | public function setServerDomainAce($serverDomainAce) |
||
| 245 | |||
| 246 | /** |
||
| 247 | * @return string |
||
| 248 | */ |
||
| 249 | public function getServerIp() |
||
| 253 | |||
| 254 | /** |
||
| 255 | * @param string $serverIp |
||
| 256 | * @return SslCheckerResult |
||
| 257 | */ |
||
| 258 | public function setServerIp($serverIp) |
||
| 263 | |||
| 264 | /** |
||
| 265 | * @return int |
||
| 266 | */ |
||
| 267 | public function getServerPort() |
||
| 271 | |||
| 272 | /** |
||
| 273 | * @param int $serverPort |
||
| 274 | * @return SslCheckerResult |
||
| 275 | */ |
||
| 276 | public function setServerPort($serverPort) |
||
| 281 | |||
| 282 | /** |
||
| 283 | * @return string |
||
| 284 | */ |
||
| 285 | public function getServerSoftware() |
||
| 289 | |||
| 290 | /** |
||
| 291 | * @param string $serverSoftware |
||
| 292 | * @return SslCheckerResult |
||
| 293 | */ |
||
| 294 | public function setServerSoftware($serverSoftware) |
||
| 299 | |||
| 300 | /** |
||
| 301 | * @return \DateTime |
||
| 302 | */ |
||
| 303 | public function getCertNotBefore() |
||
| 307 | |||
| 308 | /** |
||
| 309 | * @param \DateTime $certNotBefore |
||
| 310 | * @return SslCheckerResult |
||
| 311 | */ |
||
| 312 | public function setCertNotBefore($certNotBefore) |
||
| 317 | |||
| 318 | /** |
||
| 319 | * @param integer $certNotBefore |
||
| 320 | * @return SslCheckerResult |
||
| 321 | */ |
||
| 322 | public function setCertNotBeforeFromUnixTimestamp($certNotBefore) |
||
| 327 | |||
| 328 | /** |
||
| 329 | * @return \DateTime |
||
| 330 | */ |
||
| 331 | public function getCertNotAfter() |
||
| 335 | |||
| 336 | /** |
||
| 337 | * @param \DateTime $certNotAfter |
||
| 338 | * @return SslCheckerResult |
||
| 339 | */ |
||
| 340 | public function setCertNotAfter($certNotAfter) |
||
| 345 | |||
| 346 | /** |
||
| 347 | * @param integer $certNotAfter |
||
| 348 | * @return SslCheckerResult |
||
| 349 | */ |
||
| 350 | public function setCertNotAfterFromUnixTimestamp($certNotAfter) |
||
| 355 | |||
| 356 | /** |
||
| 357 | * @return \DateTime |
||
| 358 | */ |
||
| 359 | public function getCertValidityNotBefore() |
||
| 363 | |||
| 364 | /** |
||
| 365 | * @param \DateTime $certValidityNotBefore |
||
| 366 | * @return SslCheckerResult |
||
| 367 | */ |
||
| 368 | public function setCertValidityNotBefore($certValidityNotBefore) |
||
| 373 | |||
| 374 | /** |
||
| 375 | * @return \DateTime |
||
| 376 | */ |
||
| 377 | public function getCertValidityNotAfter() |
||
| 381 | |||
| 382 | /** |
||
| 383 | * @param \DateTime $certValidityNotAfter |
||
| 384 | * @return SslCheckerResult |
||
| 385 | */ |
||
| 386 | public function setCertValidityNotAfter($certValidityNotAfter) |
||
| 391 | |||
| 392 | /** |
||
| 393 | * @return string |
||
| 394 | */ |
||
| 395 | public function getCertKeyAlgorithm() |
||
| 399 | |||
| 400 | /** |
||
| 401 | * @param string $certKeyAlgorithm |
||
| 402 | * @return SslCheckerResult |
||
| 403 | */ |
||
| 404 | public function setCertKeyAlgorithm($certKeyAlgorithm) |
||
| 409 | |||
| 410 | /** |
||
| 411 | * @return string |
||
| 412 | */ |
||
| 413 | public function getCertKeySize() |
||
| 417 | |||
| 418 | /** |
||
| 419 | * @param string $certKeySize |
||
| 420 | * @return SslCheckerResult |
||
| 421 | */ |
||
| 422 | public function setCertKeySize($certKeySize) |
||
| 427 | |||
| 428 | /** |
||
| 429 | * @return string |
||
| 430 | */ |
||
| 431 | public function getCertSubjectDN() |
||
| 435 | |||
| 436 | /** |
||
| 437 | * @param string $certSubjectDN |
||
| 438 | * @return SslCheckerResult |
||
| 439 | */ |
||
| 440 | public function setCertSubjectDN($certSubjectDN) |
||
| 445 | |||
| 446 | /** |
||
| 447 | * @return string |
||
| 448 | */ |
||
| 449 | public function getCertSubjectCN() |
||
| 453 | |||
| 454 | /** |
||
| 455 | * @param string $certSubjectCN |
||
| 456 | * @return SslCheckerResult |
||
| 457 | */ |
||
| 458 | public function setCertSubjectCN($certSubjectCN) |
||
| 463 | |||
| 464 | /** |
||
| 465 | * @return string |
||
| 466 | */ |
||
| 467 | public function getCertSubjectOU() |
||
| 471 | |||
| 472 | /** |
||
| 473 | * @param string $certSubjectOU |
||
| 474 | * @return SslCheckerResult |
||
| 475 | */ |
||
| 476 | public function setCertSubjectOU($certSubjectOU) |
||
| 481 | |||
| 482 | /** |
||
| 483 | * @return string |
||
| 484 | */ |
||
| 485 | public function getCertSubjectOrganization() |
||
| 489 | |||
| 490 | /** |
||
| 491 | * @param string $certSubjectOrganization |
||
| 492 | * @return SslCheckerResult |
||
| 493 | */ |
||
| 494 | public function setCertSubjectOrganization($certSubjectOrganization) |
||
| 499 | |||
| 500 | /** |
||
| 501 | * @return string |
||
| 502 | */ |
||
| 503 | public function getCertSubjectStreetAddress1() |
||
| 507 | |||
| 508 | /** |
||
| 509 | * @param string $certSubjectStreetAddress1 |
||
| 510 | * @return SslCheckerResult |
||
| 511 | */ |
||
| 512 | public function setCertSubjectStreetAddress1($certSubjectStreetAddress1) |
||
| 517 | |||
| 518 | /** |
||
| 519 | * @return string |
||
| 520 | */ |
||
| 521 | public function getCertSubjectStreetAddress2() |
||
| 525 | |||
| 526 | /** |
||
| 527 | * @param string $certSubjectStreetAddress2 |
||
| 528 | * @return SslCheckerResult |
||
| 529 | */ |
||
| 530 | public function setCertSubjectStreetAddress2($certSubjectStreetAddress2) |
||
| 535 | |||
| 536 | /** |
||
| 537 | * @return string |
||
| 538 | */ |
||
| 539 | public function getCertSubjectStreetAddress3() |
||
| 543 | |||
| 544 | /** |
||
| 545 | * @param string $certSubjectStreetAddress3 |
||
| 546 | * @return SslCheckerResult |
||
| 547 | */ |
||
| 548 | public function setCertSubjectStreetAddress3($certSubjectStreetAddress3) |
||
| 553 | |||
| 554 | /** |
||
| 555 | * @return string |
||
| 556 | */ |
||
| 557 | public function getCertSubjectLocality() |
||
| 561 | |||
| 562 | /** |
||
| 563 | * @param string $certSubjectLocality |
||
| 564 | * @return SslCheckerResult |
||
| 565 | */ |
||
| 566 | public function setCertSubjectLocality($certSubjectLocality) |
||
| 571 | |||
| 572 | /** |
||
| 573 | * @return string |
||
| 574 | */ |
||
| 575 | public function getCertSubjectState() |
||
| 579 | |||
| 580 | /** |
||
| 581 | * @param string $certSubjectState |
||
| 582 | * @return SslCheckerResult |
||
| 583 | */ |
||
| 584 | public function setCertSubjectState($certSubjectState) |
||
| 589 | |||
| 590 | /** |
||
| 591 | * @return string |
||
| 592 | */ |
||
| 593 | public function getCertSubjectPostalCode() |
||
| 597 | |||
| 598 | /** |
||
| 599 | * @param string $certSubjectPostalCode |
||
| 600 | * @return SslCheckerResult |
||
| 601 | */ |
||
| 602 | public function setCertSubjectPostalCode($certSubjectPostalCode) |
||
| 607 | |||
| 608 | /** |
||
| 609 | * @return string |
||
| 610 | */ |
||
| 611 | public function getCertSubjectCountry() |
||
| 615 | |||
| 616 | /** |
||
| 617 | * @param string $certSubjectCountry |
||
| 618 | * @return SslCheckerResult |
||
| 619 | */ |
||
| 620 | public function setCertSubjectCountry($certSubjectCountry) |
||
| 625 | |||
| 626 | /** |
||
| 627 | * @return string |
||
| 628 | */ |
||
| 629 | public function getCertIsMultiDomain() |
||
| 633 | |||
| 634 | /** |
||
| 635 | * @param string $certIsMultiDomain |
||
| 636 | * @return SslCheckerResult |
||
| 637 | */ |
||
| 638 | public function setCertIsMultiDomain($certIsMultiDomain) |
||
| 643 | |||
| 644 | /** |
||
| 645 | * @return string |
||
| 646 | */ |
||
| 647 | public function getCertIsWildcard() |
||
| 651 | |||
| 652 | /** |
||
| 653 | * @param string $certIsWildcard |
||
| 654 | * @return SslCheckerResult |
||
| 655 | */ |
||
| 656 | public function setCertIsWildcard($certIsWildcard) |
||
| 661 | |||
| 662 | /** |
||
| 663 | * @return string |
||
| 664 | */ |
||
| 665 | public function getCertIssuerDN() |
||
| 669 | |||
| 670 | /** |
||
| 671 | * @param string $certIssuerDN |
||
| 672 | * @return SslCheckerResult |
||
| 673 | */ |
||
| 674 | public function setCertIssuerDN($certIssuerDN) |
||
| 679 | |||
| 680 | /** |
||
| 681 | * @return string |
||
| 682 | */ |
||
| 683 | public function getCertIssuerCN() |
||
| 687 | |||
| 688 | /** |
||
| 689 | * @param string $certIssuerCN |
||
| 690 | * @return SslCheckerResult |
||
| 691 | */ |
||
| 692 | public function setCertIssuerCN($certIssuerCN) |
||
| 697 | |||
| 698 | /** |
||
| 699 | * @return string |
||
| 700 | */ |
||
| 701 | public function getCertIssuerOrganization() |
||
| 705 | |||
| 706 | /** |
||
| 707 | * @param string $certIssuerOrganization |
||
| 708 | * @return SslCheckerResult |
||
| 709 | */ |
||
| 710 | public function setCertIssuerOrganization($certIssuerOrganization) |
||
| 715 | |||
| 716 | /** |
||
| 717 | * @return string |
||
| 718 | */ |
||
| 719 | public function getCertIssuerCountry() |
||
| 723 | |||
| 724 | /** |
||
| 725 | * @param string $certIssuerCountry |
||
| 726 | * @return SslCheckerResult |
||
| 727 | */ |
||
| 728 | public function setCertIssuerCountry($certIssuerCountry) |
||
| 733 | |||
| 734 | /** |
||
| 735 | * @return string |
||
| 736 | */ |
||
| 737 | public function getCertIssuerBrand() |
||
| 741 | |||
| 742 | /** |
||
| 743 | * @param string $certIssuerBrand |
||
| 744 | * @return SslCheckerResult |
||
| 745 | */ |
||
| 746 | public function setCertIssuerBrand($certIssuerBrand) |
||
| 751 | |||
| 752 | /** |
||
| 753 | * @return string |
||
| 754 | */ |
||
| 755 | public function getCertPolicyOID() |
||
| 759 | |||
| 760 | /** |
||
| 761 | * @param string $certPolicyOID |
||
| 762 | * @return SslCheckerResult |
||
| 763 | */ |
||
| 764 | public function setCertPolicyOID($certPolicyOID) |
||
| 769 | |||
| 770 | /** |
||
| 771 | * @return string |
||
| 772 | */ |
||
| 773 | public function getCertValidation() |
||
| 777 | |||
| 778 | /** |
||
| 779 | * @param string $certValidation |
||
| 780 | * @return SslCheckerResult |
||
| 781 | */ |
||
| 782 | public function setCertValidation($certValidation) |
||
| 787 | |||
| 788 | } |
||
| 789 |
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..