Complex classes like FacadeMarkedProductsResponse 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 FacadeMarkedProductsResponse, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 9 | final class FacadeMarkedProductsResponse |
||
| 10 | { |
||
| 11 | public const STATUS_EMITTED = 'EMITTED'; |
||
| 12 | public const STATUS_APPLIED = 'APPLIED'; |
||
| 13 | public const STATUS_INTRODUCED = 'INTRODUCED'; |
||
| 14 | public const STATUS_RETIRED = 'RETIRED'; |
||
| 15 | public const STATUS_ISSUED = 'ISSUED'; |
||
| 16 | public const STATUS_WRITTEN_OFF = 'WRITTEN_OFF'; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | private $cis; |
||
| 22 | /** |
||
| 23 | * @var string |
||
| 24 | */ |
||
| 25 | private $gtin; |
||
| 26 | /** |
||
| 27 | * @var string |
||
| 28 | * @SerializedName("sgtin") |
||
| 29 | */ |
||
| 30 | private $sgtin; |
||
| 31 | /** |
||
| 32 | * @var string|null |
||
| 33 | * @SerializedName("productName") |
||
| 34 | */ |
||
| 35 | private $productName; |
||
| 36 | /** |
||
| 37 | * @var string|null |
||
| 38 | * @SerializedName("ownerName") |
||
| 39 | */ |
||
| 40 | private $ownerName; |
||
| 41 | /** |
||
| 42 | * @var string|null |
||
| 43 | * @SerializedName("ownerInn") |
||
| 44 | */ |
||
| 45 | private $ownerInn; |
||
| 46 | /** |
||
| 47 | * @var string |
||
| 48 | * @SerializedName("producerName") |
||
| 49 | */ |
||
| 50 | private $producerName; |
||
| 51 | /** |
||
| 52 | * @var string |
||
| 53 | * @SerializedName("producerInn") |
||
| 54 | */ |
||
| 55 | private $producerInn; |
||
| 56 | /** |
||
| 57 | * @var string|null |
||
| 58 | * @SerializedName("agentName") |
||
| 59 | */ |
||
| 60 | private $agentName; |
||
| 61 | /** |
||
| 62 | * @var string|null |
||
| 63 | * @SerializedName("agentInn") |
||
| 64 | */ |
||
| 65 | private $agentInn; |
||
| 66 | /** |
||
| 67 | * @var string |
||
| 68 | */ |
||
| 69 | private $status; |
||
| 70 | /** |
||
| 71 | * @var string |
||
| 72 | * @SerializedName("emissionDate") |
||
| 73 | */ |
||
| 74 | private $emissionDate; |
||
| 75 | /** |
||
| 76 | * @var string |
||
| 77 | * @SerializedName("emissionType") |
||
| 78 | */ |
||
| 79 | private $emissionType; |
||
| 80 | /** |
||
| 81 | * @var string|null |
||
| 82 | * @SerializedName("introducedDate") |
||
| 83 | */ |
||
| 84 | private $introducedDate; |
||
| 85 | /** |
||
| 86 | * @var string|null |
||
| 87 | */ |
||
| 88 | private $name; |
||
| 89 | /** |
||
| 90 | * @var string|null |
||
| 91 | */ |
||
| 92 | private $brand; |
||
| 93 | /** |
||
| 94 | * @var string|null |
||
| 95 | */ |
||
| 96 | private $model; |
||
| 97 | /** |
||
| 98 | * @var FacadeMarkedProductsCertDoc[] |
||
| 99 | * @SerializedName("prevCises") |
||
| 100 | */ |
||
| 101 | private $prevCises; |
||
| 102 | /** |
||
| 103 | * @var FacadeMarkedProductsCertDoc[] |
||
| 104 | * @SerializedName("nextCises") |
||
| 105 | */ |
||
| 106 | private $nextCises; |
||
| 107 | /** |
||
| 108 | * @var string|null |
||
| 109 | */ |
||
| 110 | private $country; |
||
| 111 | /** |
||
| 112 | * @var string|null |
||
| 113 | * @SerializedName("productTypeDesc") |
||
| 114 | */ |
||
| 115 | private $productTypeDesc; |
||
| 116 | /** |
||
| 117 | * @var string|null |
||
| 118 | */ |
||
| 119 | private $color; |
||
| 120 | /** |
||
| 121 | * @var string|null |
||
| 122 | * @SerializedName("materialDown") |
||
| 123 | */ |
||
| 124 | private $materialDown; |
||
| 125 | /** |
||
| 126 | * @var string|null |
||
| 127 | * @SerializedName("materialUpper") |
||
| 128 | */ |
||
| 129 | private $materialUpper; |
||
| 130 | /** |
||
| 131 | * @var string|null |
||
| 132 | * @SerializedName("materialLining") |
||
| 133 | */ |
||
| 134 | private $materialLining; |
||
| 135 | /** |
||
| 136 | * @var string |
||
| 137 | * @SerializedName("packType") |
||
| 138 | */ |
||
| 139 | private $packType; |
||
| 140 | /** |
||
| 141 | * @var int |
||
| 142 | * @SerializedName("countChildren") |
||
| 143 | */ |
||
| 144 | private $countChildren; |
||
| 145 | /** |
||
| 146 | * @var string|null |
||
| 147 | * @SerializedName("goodSignedFlag") |
||
| 148 | */ |
||
| 149 | private $goodSignedFlag; |
||
| 150 | /** |
||
| 151 | * @var string|null |
||
| 152 | * @SerializedName("goodTurnFlag") |
||
| 153 | */ |
||
| 154 | private $goodTurnFlag; |
||
| 155 | /** |
||
| 156 | * @var string|null |
||
| 157 | * @SerializedName("goodMarkFlag") |
||
| 158 | */ |
||
| 159 | private $goodMarkFlag; |
||
| 160 | /** |
||
| 161 | * @var string|null |
||
| 162 | * @SerializedName("lastDocId") |
||
| 163 | */ |
||
| 164 | private $lastDocId; |
||
| 165 | |||
| 166 | public function __construct( |
||
| 193 | |||
| 194 | public function getCis(): string |
||
| 198 | |||
| 199 | public function getGtin(): string |
||
| 203 | |||
| 204 | public function getSgtin(): string |
||
| 208 | |||
| 209 | public function getProductName(): ?string |
||
| 213 | |||
| 214 | public function getOwnerName(): string |
||
| 218 | |||
| 219 | public function getOwnerInn(): string |
||
| 223 | |||
| 224 | public function getProducerName(): string |
||
| 228 | |||
| 229 | public function getProducerInn(): string |
||
| 233 | |||
| 234 | public function getAgentName(): ?string |
||
| 238 | |||
| 239 | public function getAgentInn(): ?string |
||
| 243 | |||
| 244 | public function getStatus(): string |
||
| 248 | |||
| 249 | public function getEmissionDate(): string |
||
| 253 | |||
| 254 | public function getEmissionType(): string |
||
| 258 | |||
| 259 | public function getIntroducedDate(): ?string |
||
| 263 | |||
| 264 | public function getName(): ?string |
||
| 268 | |||
| 269 | public function getBrand(): ?string |
||
| 273 | |||
| 274 | public function getModel(): ?string |
||
| 278 | |||
| 279 | /** |
||
| 280 | * @return FacadeMarkedProductsCertDoc[] |
||
| 281 | */ |
||
| 282 | public function getPrevCises(): array |
||
| 286 | |||
| 287 | /** |
||
| 288 | * @return FacadeMarkedProductsCertDoc[] |
||
| 289 | */ |
||
| 290 | public function getNextCises(): array |
||
| 294 | |||
| 295 | public function getCountry(): ?string |
||
| 299 | |||
| 300 | public function getProductTypeDesc(): ?string |
||
| 304 | |||
| 305 | public function getColor(): ?string |
||
| 309 | |||
| 310 | public function getMaterialDown(): ?string |
||
| 314 | |||
| 315 | public function getMaterialUpper(): ?string |
||
| 319 | |||
| 320 | public function getMaterialLining(): ?string |
||
| 324 | |||
| 325 | public function getPackType(): string |
||
| 329 | |||
| 330 | public function getCountChildren(): int |
||
| 334 | |||
| 335 | public function getGoodSignedFlag(): ?string |
||
| 339 | |||
| 340 | public function getGoodTurnFlag(): ?string |
||
| 344 | |||
| 345 | public function getGoodMarkFlag(): ?string |
||
| 349 | |||
| 350 | public function getLastDocId(): ?string |
||
| 354 | |||
| 355 | public function setProductName(?string $productName): FacadeMarkedProductsResponse |
||
| 360 | |||
| 361 | public function setOwnerName(?string $ownerName): self |
||
| 367 | |||
| 368 | public function setOwnerInn(?string $ownerInn): self |
||
| 374 | |||
| 375 | public function setAgentName(?string $agentName): FacadeMarkedProductsResponse |
||
| 380 | |||
| 381 | public function setAgentInn(?string $agentInn): FacadeMarkedProductsResponse |
||
| 386 | |||
| 387 | public function setIntroducedDate(?string $introducedDate): FacadeMarkedProductsResponse |
||
| 392 | |||
| 393 | public function setName(?string $name): FacadeMarkedProductsResponse |
||
| 398 | |||
| 399 | public function setBrand(?string $brand): FacadeMarkedProductsResponse |
||
| 404 | |||
| 405 | public function setModel(?string $model): FacadeMarkedProductsResponse |
||
| 410 | |||
| 411 | public function setCountry(?string $country): FacadeMarkedProductsResponse |
||
| 416 | |||
| 417 | public function setProductTypeDesc(?string $productTypeDesc): FacadeMarkedProductsResponse |
||
| 422 | |||
| 423 | public function setColor(?string $color): FacadeMarkedProductsResponse |
||
| 428 | |||
| 429 | public function setMaterialDown(?string $materialDown): FacadeMarkedProductsResponse |
||
| 434 | |||
| 435 | public function setMaterialUpper(?string $materialUpper): FacadeMarkedProductsResponse |
||
| 440 | |||
| 441 | public function setMaterialLining(?string $materialLining): FacadeMarkedProductsResponse |
||
| 446 | |||
| 447 | public function setGoodSignedFlag(?string $goodSignedFlag): FacadeMarkedProductsResponse |
||
| 452 | |||
| 453 | public function setGoodTurnFlag(?string $goodTurnFlag): FacadeMarkedProductsResponse |
||
| 458 | |||
| 459 | public function setGoodMarkFlag(?string $goodMarkFlag): FacadeMarkedProductsResponse |
||
| 464 | |||
| 465 | public function setLastDocId(?string $lastDocId): FacadeMarkedProductsResponse |
||
| 470 | } |
||
| 471 |