| Total Complexity | 55 |
| Total Lines | 662 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like CaseSO 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.
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 CaseSO, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 12 | class CaseSO extends AbstractSObject |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var string|null |
||
| 16 | * @JMS\Type("string") |
||
| 17 | * @JMS\Groups({"create", "update"}) |
||
| 18 | */ |
||
| 19 | protected $accountId; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var string|null |
||
| 23 | * @JMS\Type("string") |
||
| 24 | */ |
||
| 25 | protected $caseNumber; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var \DateTimeInterface|null |
||
| 29 | * @JMS\Type("DateTime<'Y-m-d\TH:i:s.\0\0\0O'>") |
||
| 30 | */ |
||
| 31 | protected $closedDate; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var string|null |
||
| 35 | * @JMS\Type("string") |
||
| 36 | */ |
||
| 37 | protected $contactEmail; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @var string|null |
||
| 41 | * @JMS\Type("string") |
||
| 42 | */ |
||
| 43 | protected $contactFax; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @var string|null |
||
| 47 | * @JMS\Type("string") |
||
| 48 | * @JMS\Groups({"create", "update"}) |
||
| 49 | */ |
||
| 50 | protected $contactId; |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @var string|null |
||
| 54 | * @JMS\Type("string") |
||
| 55 | */ |
||
| 56 | protected $contactMobile; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @var string|null |
||
| 60 | * @JMS\Type("string") |
||
| 61 | */ |
||
| 62 | protected $ContactPhone; |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @var string|null |
||
| 66 | * @JMS\Type("string") |
||
| 67 | */ |
||
| 68 | protected $creatorFullPhotoUrl; |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @var string|null |
||
| 72 | * @JMS\Type("string") |
||
| 73 | */ |
||
| 74 | protected $creatorName; |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @var string|null |
||
| 78 | * @JMS\Type("string") |
||
| 79 | */ |
||
| 80 | protected $creatorSmallPhotoUrl; |
||
| 81 | |||
| 82 | /** |
||
| 83 | * @var string|null |
||
| 84 | * @JMS\Type("string") |
||
| 85 | * @JMS\Groups({"create", "update"}) |
||
| 86 | */ |
||
| 87 | protected $description; |
||
| 88 | |||
| 89 | /** |
||
| 90 | * @var string|null |
||
| 91 | * @JMS\Type("string") |
||
| 92 | * @JMS\Groups({"create"}) |
||
| 93 | */ |
||
| 94 | protected $feedItemId; |
||
| 95 | |||
| 96 | /** |
||
| 97 | * @var bool|null |
||
| 98 | * @JMS\Type("boolean") |
||
| 99 | */ |
||
| 100 | protected $hasCommentsUnreadByOwner; |
||
| 101 | |||
| 102 | /** |
||
| 103 | * @var bool|null |
||
| 104 | * @JMS\Type("boolean") |
||
| 105 | */ |
||
| 106 | protected $hasSelfServiceComments; |
||
| 107 | |||
| 108 | /** |
||
| 109 | * @var bool|null |
||
| 110 | * @JMS\Type("boolean") |
||
| 111 | */ |
||
| 112 | protected $IsClosed; |
||
| 113 | |||
| 114 | /** |
||
| 115 | * @var bool|null |
||
| 116 | * @JMS\Type("boolean") |
||
| 117 | */ |
||
| 118 | protected $isClosedOnCreate; |
||
| 119 | |||
| 120 | /** |
||
| 121 | * @var bool|null |
||
| 122 | * @JMS\Type("boolean") |
||
| 123 | */ |
||
| 124 | protected $isDeleted; |
||
| 125 | |||
| 126 | /** |
||
| 127 | * @var bool|null |
||
| 128 | * @JMS\Type("boolean") |
||
| 129 | * @JMS\Groups({"create", "update"}) |
||
| 130 | */ |
||
| 131 | protected $isEscalated; |
||
| 132 | |||
| 133 | /** |
||
| 134 | * @var bool|null |
||
| 135 | * @JMS\Type("boolean") |
||
| 136 | */ |
||
| 137 | protected $isSelfServiceClosed; |
||
| 138 | |||
| 139 | /** |
||
| 140 | * @var bool|null |
||
| 141 | * @JMS\Type("boolean") |
||
| 142 | */ |
||
| 143 | protected $isStopped; |
||
| 144 | |||
| 145 | /** |
||
| 146 | * @var bool|null |
||
| 147 | * @JMS\Type("boolean") |
||
| 148 | */ |
||
| 149 | protected $isVisibleInSelfService; |
||
| 150 | |||
| 151 | /** |
||
| 152 | * @var \DateTimeInterface|null |
||
| 153 | * @JMS\Type("DateTime<'Y-m-d\TH:i:s.\0\0\0O'>") |
||
| 154 | */ |
||
| 155 | protected $lastReferencedDate; |
||
| 156 | |||
| 157 | /** |
||
| 158 | * @var \DateTimeInterface|null |
||
| 159 | * @JMS\Type("DateTime<'Y-m-d\TH:i:s.\0\0\0O'>") |
||
| 160 | */ |
||
| 161 | protected $lastViewedDate; |
||
| 162 | |||
| 163 | /** |
||
| 164 | * @var string|null |
||
| 165 | * @JMS\Type("string") |
||
| 166 | * @JMS\Groups({"create", "update"}) |
||
| 167 | */ |
||
| 168 | protected $origin; |
||
| 169 | |||
| 170 | /** |
||
| 171 | * @var string|null |
||
| 172 | * @JMS\Type("string") |
||
| 173 | * @JMS\Groups({"create", "update"}) |
||
| 174 | */ |
||
| 175 | protected $ownerId; |
||
| 176 | |||
| 177 | /** |
||
| 178 | * @var string|null |
||
| 179 | * @JMS\Type("string") |
||
| 180 | * @JMS\Groups({"create", "update"}) |
||
| 181 | */ |
||
| 182 | protected $parentId; |
||
| 183 | |||
| 184 | /** |
||
| 185 | * @var string|null |
||
| 186 | * @JMS\Type("string") |
||
| 187 | * @JMS\Groups({"create", "update"}) |
||
| 188 | */ |
||
| 189 | protected $priority; |
||
| 190 | |||
| 191 | /** |
||
| 192 | * @var string|null |
||
| 193 | * @JMS\Type("string") |
||
| 194 | * @JMS\Groups({"create", "update"}) |
||
| 195 | */ |
||
| 196 | protected $reason; |
||
| 197 | |||
| 198 | /** |
||
| 199 | * @var string|null |
||
| 200 | * @JMS\Type("string") |
||
| 201 | * @JMS\Groups({"create", "update"}) |
||
| 202 | */ |
||
| 203 | protected $status; |
||
| 204 | |||
| 205 | /** |
||
| 206 | * @var \DateTimeInterface|null |
||
| 207 | * @JMS\Type("DateTime<'Y-m-d\TH:i:s.\0\0\0O'>") |
||
| 208 | */ |
||
| 209 | protected $stopStartDate; |
||
| 210 | |||
| 211 | /** |
||
| 212 | * @var string|null |
||
| 213 | * @JMS\Type("string") |
||
| 214 | * @JMS\Groups({"create", "update"}) |
||
| 215 | */ |
||
| 216 | protected $subject; |
||
| 217 | |||
| 218 | /** |
||
| 219 | * @var string|null |
||
| 220 | * @JMS\Type("string") |
||
| 221 | * @JMS\Groups({"create", "update"}) |
||
| 222 | */ |
||
| 223 | protected $suppliedCompany; |
||
| 224 | |||
| 225 | /** |
||
| 226 | * @var string|null |
||
| 227 | * @JMS\Type("string") |
||
| 228 | * @JMS\Groups({"create", "update"}) |
||
| 229 | */ |
||
| 230 | protected $suppliedEmail; |
||
| 231 | |||
| 232 | /** |
||
| 233 | * @var string|null |
||
| 234 | * @JMS\Type("string") |
||
| 235 | * @JMS\Groups({"create", "update"}) |
||
| 236 | */ |
||
| 237 | protected $suppliedName; |
||
| 238 | |||
| 239 | /** |
||
| 240 | * @var string|null |
||
| 241 | * @JMS\Type("string") |
||
| 242 | * @JMS\Groups({"create", "update"}) |
||
| 243 | */ |
||
| 244 | protected $suppliedPhone; |
||
| 245 | |||
| 246 | /** |
||
| 247 | * @var string|null |
||
| 248 | * @JMS\Type("string") |
||
| 249 | * @JMS\Groups({"create", "update"}) |
||
| 250 | */ |
||
| 251 | protected $type; |
||
| 252 | |||
| 253 | /** |
||
| 254 | * {@inheritdoc} |
||
| 255 | */ |
||
| 256 | public static function getSObjectName(): AbstractSObjectType |
||
| 257 | { |
||
| 258 | return SObjectType::CASE_SO(); |
||
| 259 | } |
||
| 260 | |||
| 261 | /** |
||
| 262 | * @return string|null |
||
| 263 | */ |
||
| 264 | public function getAccountId() |
||
| 265 | { |
||
| 266 | return $this->accountId; |
||
| 267 | } |
||
| 268 | |||
| 269 | /** |
||
| 270 | * @return string|null |
||
| 271 | */ |
||
| 272 | public function getCaseNumber() |
||
| 273 | { |
||
| 274 | return $this->caseNumber; |
||
| 275 | } |
||
| 276 | |||
| 277 | /** |
||
| 278 | * @return \DateTimeInterface|null |
||
| 279 | */ |
||
| 280 | public function getClosedDate() |
||
| 281 | { |
||
| 282 | return $this->closedDate; |
||
| 283 | } |
||
| 284 | |||
| 285 | /** |
||
| 286 | * @return string|null |
||
| 287 | */ |
||
| 288 | public function getContactEmail() |
||
| 289 | { |
||
| 290 | return $this->contactEmail; |
||
| 291 | } |
||
| 292 | |||
| 293 | /** |
||
| 294 | * @return string|null |
||
| 295 | */ |
||
| 296 | public function getContactFax() |
||
| 299 | } |
||
| 300 | |||
| 301 | /** |
||
| 302 | * @return string|null |
||
| 303 | */ |
||
| 304 | public function getContactId() |
||
| 305 | { |
||
| 306 | return $this->contactId; |
||
| 307 | } |
||
| 308 | |||
| 309 | /** |
||
| 310 | * @return string|null |
||
| 311 | */ |
||
| 312 | public function getContactMobile() |
||
| 313 | { |
||
| 314 | return $this->contactMobile; |
||
| 315 | } |
||
| 316 | |||
| 317 | /** |
||
| 318 | * @return string|null |
||
| 319 | */ |
||
| 320 | public function getContactPhone() |
||
| 321 | { |
||
| 322 | return $this->ContactPhone; |
||
| 323 | } |
||
| 324 | |||
| 325 | /** |
||
| 326 | * @return string|null |
||
| 327 | */ |
||
| 328 | public function getCreatorFullPhotoUrl() |
||
| 329 | { |
||
| 330 | return $this->creatorFullPhotoUrl; |
||
| 331 | } |
||
| 332 | |||
| 333 | /** |
||
| 334 | * @return string|null |
||
| 335 | */ |
||
| 336 | public function getCreatorName() |
||
| 337 | { |
||
| 338 | return $this->creatorName; |
||
| 339 | } |
||
| 340 | |||
| 341 | /** |
||
| 342 | * @return string|null |
||
| 343 | */ |
||
| 344 | public function getCreatorSmallPhotoUrl() |
||
| 345 | { |
||
| 346 | return $this->creatorSmallPhotoUrl; |
||
| 347 | } |
||
| 348 | |||
| 349 | /** |
||
| 350 | * @return string|null |
||
| 351 | */ |
||
| 352 | public function getDescription() |
||
| 353 | { |
||
| 354 | return $this->description; |
||
| 355 | } |
||
| 356 | |||
| 357 | /** |
||
| 358 | * @return string|null |
||
| 359 | */ |
||
| 360 | public function getFeedItemId() |
||
| 361 | { |
||
| 362 | return $this->feedItemId; |
||
| 363 | } |
||
| 364 | |||
| 365 | /** |
||
| 366 | * @return bool|null |
||
| 367 | */ |
||
| 368 | public function hasCommentsUnreadByOwner() |
||
| 369 | { |
||
| 370 | return $this->hasCommentsUnreadByOwner; |
||
| 371 | } |
||
| 372 | |||
| 373 | /** |
||
| 374 | * @return bool|null |
||
| 375 | */ |
||
| 376 | public function hasSelfServiceComments() |
||
| 377 | { |
||
| 378 | return $this->hasSelfServiceComments; |
||
| 379 | } |
||
| 380 | |||
| 381 | /** |
||
| 382 | * @return bool|null |
||
| 383 | */ |
||
| 384 | public function isClosed() |
||
| 385 | { |
||
| 386 | return $this->IsClosed; |
||
| 387 | } |
||
| 388 | |||
| 389 | /** |
||
| 390 | * @return bool|null |
||
| 391 | */ |
||
| 392 | public function isClosedOnCreate() |
||
| 393 | { |
||
| 394 | return $this->isClosedOnCreate; |
||
| 395 | } |
||
| 396 | |||
| 397 | /** |
||
| 398 | * @return bool|null |
||
| 399 | */ |
||
| 400 | public function isDeleted() |
||
| 401 | { |
||
| 402 | return $this->isDeleted; |
||
| 403 | } |
||
| 404 | |||
| 405 | /** |
||
| 406 | * @return bool|null |
||
| 407 | */ |
||
| 408 | public function isEscalated() |
||
| 409 | { |
||
| 410 | return $this->isEscalated; |
||
| 411 | } |
||
| 412 | |||
| 413 | /** |
||
| 414 | * @return bool|null |
||
| 415 | */ |
||
| 416 | public function isSelfServiceClosed() |
||
| 417 | { |
||
| 418 | return $this->isSelfServiceClosed; |
||
| 419 | } |
||
| 420 | |||
| 421 | /** |
||
| 422 | * @return bool|null |
||
| 423 | */ |
||
| 424 | public function isStopped() |
||
| 425 | { |
||
| 426 | return $this->isStopped; |
||
| 427 | } |
||
| 428 | |||
| 429 | /** |
||
| 430 | * @return bool|null |
||
| 431 | */ |
||
| 432 | public function isVisibleInSelfService() |
||
| 433 | { |
||
| 434 | return $this->isVisibleInSelfService; |
||
| 435 | } |
||
| 436 | |||
| 437 | /** |
||
| 438 | * @return \DateTimeInterface|null |
||
| 439 | */ |
||
| 440 | public function getLastReferencedDate() |
||
| 441 | { |
||
| 442 | return $this->lastReferencedDate; |
||
| 443 | } |
||
| 444 | |||
| 445 | /** |
||
| 446 | * @return \DateTimeInterface|null |
||
| 447 | */ |
||
| 448 | public function getLastViewedDate() |
||
| 449 | { |
||
| 450 | return $this->lastViewedDate; |
||
| 451 | } |
||
| 452 | |||
| 453 | /** |
||
| 454 | * @return string|null |
||
| 455 | */ |
||
| 456 | public function getOrigin() |
||
| 457 | { |
||
| 458 | return $this->origin; |
||
| 459 | } |
||
| 460 | |||
| 461 | /** |
||
| 462 | * @return string|null |
||
| 463 | */ |
||
| 464 | public function getOwnerId() |
||
| 465 | { |
||
| 466 | return $this->ownerId; |
||
| 467 | } |
||
| 468 | |||
| 469 | /** |
||
| 470 | * @return string|null |
||
| 471 | */ |
||
| 472 | public function getParentId() |
||
| 473 | { |
||
| 474 | return $this->parentId; |
||
| 475 | } |
||
| 476 | |||
| 477 | /** |
||
| 478 | * @return string|null |
||
| 479 | */ |
||
| 480 | public function getPriority() |
||
| 481 | { |
||
| 482 | return $this->priority; |
||
| 483 | } |
||
| 484 | |||
| 485 | /** |
||
| 486 | * @return string|null |
||
| 487 | */ |
||
| 488 | public function getReason() |
||
| 489 | { |
||
| 490 | return $this->reason; |
||
| 491 | } |
||
| 492 | |||
| 493 | /** |
||
| 494 | * @return string|null |
||
| 495 | */ |
||
| 496 | public function getStatus() |
||
| 497 | { |
||
| 498 | return $this->status; |
||
| 499 | } |
||
| 500 | |||
| 501 | /** |
||
| 502 | * @return \DateTimeInterface|null |
||
| 503 | */ |
||
| 504 | public function getStopStartDate() |
||
| 505 | { |
||
| 506 | return $this->stopStartDate; |
||
| 507 | } |
||
| 508 | |||
| 509 | /** |
||
| 510 | * @return string|null |
||
| 511 | */ |
||
| 512 | public function getSubject() |
||
| 513 | { |
||
| 514 | return $this->subject; |
||
| 515 | } |
||
| 516 | |||
| 517 | /** |
||
| 518 | * @return string|null |
||
| 519 | */ |
||
| 520 | public function getSuppliedCompany() |
||
| 523 | } |
||
| 524 | |||
| 525 | /** |
||
| 526 | * @return string|null |
||
| 527 | */ |
||
| 528 | public function getSuppliedEmail() |
||
| 529 | { |
||
| 530 | return $this->suppliedEmail; |
||
| 531 | } |
||
| 532 | |||
| 533 | /** |
||
| 534 | * @return string|null |
||
| 535 | */ |
||
| 536 | public function getSuppliedName() |
||
| 537 | { |
||
| 538 | return $this->suppliedName; |
||
| 539 | } |
||
| 540 | |||
| 541 | /** |
||
| 542 | * @return string|null |
||
| 543 | */ |
||
| 544 | public function getSuppliedPhone() |
||
| 547 | } |
||
| 548 | |||
| 549 | /** |
||
| 550 | * @return string|null |
||
| 551 | */ |
||
| 552 | public function getType() |
||
| 553 | { |
||
| 554 | return $this->type; |
||
| 555 | } |
||
| 556 | |||
| 557 | public function setAccountId(string $accountId = null): self |
||
| 558 | { |
||
| 559 | $this->accountId = $accountId; |
||
| 560 | |||
| 561 | return $this; |
||
| 562 | } |
||
| 563 | |||
| 564 | public function setContactId($contactId = null): self |
||
| 565 | { |
||
| 566 | $this->contactId = $contactId; |
||
| 567 | |||
| 568 | return $this; |
||
| 569 | } |
||
| 570 | |||
| 571 | public function setDescription(string $description = null): self |
||
| 572 | { |
||
| 573 | $this->description = $description; |
||
| 574 | |||
| 575 | return $this; |
||
| 576 | } |
||
| 577 | |||
| 578 | public function setFeedItemId(string $feedItemId = null): self |
||
| 579 | { |
||
| 580 | $this->feedItemId = $feedItemId; |
||
| 581 | |||
| 582 | return $this; |
||
| 583 | } |
||
| 584 | |||
| 585 | public function setEscalated(bool $isEscalated): self |
||
| 586 | { |
||
| 587 | $this->isEscalated = $isEscalated; |
||
| 588 | |||
| 589 | return $this; |
||
| 590 | } |
||
| 591 | |||
| 592 | public function setOrigin(string $origin = null): self |
||
| 593 | { |
||
| 594 | $this->origin = $origin; |
||
| 595 | |||
| 596 | return $this; |
||
| 597 | } |
||
| 598 | |||
| 599 | public function setOwnerId(string $ownerId): self |
||
| 600 | { |
||
| 601 | $this->ownerId = $ownerId; |
||
| 602 | |||
| 603 | return $this; |
||
| 604 | } |
||
| 605 | |||
| 606 | public function setParentId(string $parentId = null): self |
||
| 611 | } |
||
| 612 | |||
| 613 | public function setPriority(string $priority = null): self |
||
| 614 | { |
||
| 615 | $this->priority = $priority; |
||
| 616 | |||
| 617 | return $this; |
||
| 618 | } |
||
| 619 | |||
| 620 | public function setReason(string $reason = null): self |
||
| 621 | { |
||
| 622 | $this->reason = $reason; |
||
| 623 | |||
| 624 | return $this; |
||
| 625 | } |
||
| 626 | |||
| 627 | public function setStatus(string $status = null): self |
||
| 628 | { |
||
| 629 | $this->status = $status; |
||
| 630 | |||
| 631 | return $this; |
||
| 632 | } |
||
| 633 | |||
| 634 | public function setSubject(string $subject = null): self |
||
| 635 | { |
||
| 636 | $this->subject = $subject; |
||
| 637 | |||
| 638 | return $this; |
||
| 639 | } |
||
| 640 | |||
| 641 | public function setSuppliedCompany(string $suppliedCompany = null): self |
||
| 642 | { |
||
| 643 | $this->suppliedCompany = $suppliedCompany; |
||
| 644 | |||
| 645 | return $this; |
||
| 646 | } |
||
| 647 | |||
| 648 | public function setSuppliedEmail(string $suppliedEmail = null): self |
||
| 649 | { |
||
| 650 | $this->suppliedEmail = $suppliedEmail; |
||
| 651 | |||
| 652 | return $this; |
||
| 653 | } |
||
| 654 | |||
| 655 | public function setSuppliedName(string $suppliedName = null): self |
||
| 656 | { |
||
| 657 | $this->suppliedName = $suppliedName; |
||
| 658 | |||
| 659 | return $this; |
||
| 660 | } |
||
| 661 | |||
| 662 | public function setSuppliedPhone(string $suppliedPhone = null): self |
||
| 667 | } |
||
| 668 | |||
| 669 | public function setType(string $type = null): self |
||
| 674 | } |
||
| 675 | } |
||
| 676 |