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 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $cis; |
||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | private $gtin; |
||
25 | /** |
||
26 | * @var string |
||
27 | * @SerializedName("sgtin") |
||
28 | */ |
||
29 | private $sgtin; |
||
30 | /** |
||
31 | * @var string|null |
||
32 | * @SerializedName("productName") |
||
33 | */ |
||
34 | private $productName; |
||
35 | /** |
||
36 | * @var string|null |
||
37 | * @SerializedName("ownerName") |
||
38 | */ |
||
39 | private $ownerName; |
||
40 | /** |
||
41 | * @var string|null |
||
42 | * @SerializedName("ownerInn") |
||
43 | */ |
||
44 | private $ownerInn; |
||
45 | /** |
||
46 | * @var string |
||
47 | * @SerializedName("producerName") |
||
48 | */ |
||
49 | private $producerName; |
||
50 | /** |
||
51 | * @var string |
||
52 | * @SerializedName("producerInn") |
||
53 | */ |
||
54 | private $producerInn; |
||
55 | /** |
||
56 | * @var string|null |
||
57 | * @SerializedName("agentName") |
||
58 | */ |
||
59 | private $agentName; |
||
60 | /** |
||
61 | * @var string|null |
||
62 | * @SerializedName("agentInn") |
||
63 | */ |
||
64 | private $agentInn; |
||
65 | /** |
||
66 | * @var string |
||
67 | */ |
||
68 | private $status; |
||
69 | /** |
||
70 | * @var string |
||
71 | * @SerializedName("emissionDate") |
||
72 | */ |
||
73 | private $emissionDate; |
||
74 | /** |
||
75 | * @var string |
||
76 | * @SerializedName("emissionType") |
||
77 | */ |
||
78 | private $emissionType; |
||
79 | /** |
||
80 | * @var string|null |
||
81 | * @SerializedName("introducedDate") |
||
82 | */ |
||
83 | private $introducedDate; |
||
84 | /** |
||
85 | * @var string|null |
||
86 | */ |
||
87 | private $name; |
||
88 | /** |
||
89 | * @var string|null |
||
90 | */ |
||
91 | private $brand; |
||
92 | /** |
||
93 | * @var string|null |
||
94 | */ |
||
95 | private $model; |
||
96 | /** |
||
97 | * @var FacadeMarkedProductsCertDoc[] |
||
98 | * @SerializedName("prevCises") |
||
99 | */ |
||
100 | private $prevCises; |
||
101 | /** |
||
102 | * @var FacadeMarkedProductsCertDoc[] |
||
103 | * @SerializedName("nextCises") |
||
104 | */ |
||
105 | private $nextCises; |
||
106 | /** |
||
107 | * @var string|null |
||
108 | */ |
||
109 | private $country; |
||
110 | /** |
||
111 | * @var string|null |
||
112 | * @SerializedName("productTypeDesc") |
||
113 | */ |
||
114 | private $productTypeDesc; |
||
115 | /** |
||
116 | * @var string|null |
||
117 | */ |
||
118 | private $color; |
||
119 | /** |
||
120 | * @var string|null |
||
121 | * @SerializedName("materialDown") |
||
122 | */ |
||
123 | private $materialDown; |
||
124 | /** |
||
125 | * @var string|null |
||
126 | * @SerializedName("materialUpper") |
||
127 | */ |
||
128 | private $materialUpper; |
||
129 | /** |
||
130 | * @var string|null |
||
131 | * @SerializedName("materialLining") |
||
132 | */ |
||
133 | private $materialLining; |
||
134 | /** |
||
135 | * @var string |
||
136 | * @SerializedName("packType") |
||
137 | */ |
||
138 | private $packType; |
||
139 | /** |
||
140 | * @var int |
||
141 | * @SerializedName("countChildren") |
||
142 | */ |
||
143 | private $countChildren; |
||
144 | /** |
||
145 | * @var string|null |
||
146 | * @SerializedName("goodSignedFlag") |
||
147 | */ |
||
148 | private $goodSignedFlag; |
||
149 | /** |
||
150 | * @var string|null |
||
151 | * @SerializedName("goodTurnFlag") |
||
152 | */ |
||
153 | private $goodTurnFlag; |
||
154 | /** |
||
155 | * @var string|null |
||
156 | * @SerializedName("goodMarkFlag") |
||
157 | */ |
||
158 | private $goodMarkFlag; |
||
159 | /** |
||
160 | * @var string|null |
||
161 | * @SerializedName("lastDocId") |
||
162 | */ |
||
163 | private $lastDocId; |
||
164 | |||
165 | public function __construct( |
||
192 | |||
193 | public function getCis(): string |
||
197 | |||
198 | public function getGtin(): string |
||
202 | |||
203 | public function getSgtin(): string |
||
207 | |||
208 | public function getProductName(): ?string |
||
212 | |||
213 | public function getOwnerName(): string |
||
217 | |||
218 | public function getOwnerInn(): string |
||
222 | |||
223 | public function getProducerName(): string |
||
227 | |||
228 | public function getProducerInn(): string |
||
232 | |||
233 | public function getAgentName(): ?string |
||
237 | |||
238 | public function getAgentInn(): ?string |
||
242 | |||
243 | public function getStatus(): string |
||
247 | |||
248 | public function getEmissionDate(): string |
||
252 | |||
253 | public function getEmissionType(): string |
||
257 | |||
258 | public function getIntroducedDate(): ?string |
||
262 | |||
263 | public function getName(): ?string |
||
267 | |||
268 | public function getBrand(): ?string |
||
272 | |||
273 | public function getModel(): ?string |
||
277 | |||
278 | /** |
||
279 | * @return FacadeMarkedProductsCertDoc[] |
||
280 | */ |
||
281 | public function getPrevCises(): array |
||
285 | |||
286 | /** |
||
287 | * @return FacadeMarkedProductsCertDoc[] |
||
288 | */ |
||
289 | public function getNextCises(): array |
||
293 | |||
294 | public function getCountry(): ?string |
||
298 | |||
299 | public function getProductTypeDesc(): ?string |
||
303 | |||
304 | public function getColor(): ?string |
||
308 | |||
309 | public function getMaterialDown(): ?string |
||
313 | |||
314 | public function getMaterialUpper(): ?string |
||
318 | |||
319 | public function getMaterialLining(): ?string |
||
323 | |||
324 | public function getPackType(): string |
||
328 | |||
329 | public function getCountChildren(): int |
||
333 | |||
334 | public function getGoodSignedFlag(): ?string |
||
338 | |||
339 | public function getGoodTurnFlag(): ?string |
||
343 | |||
344 | public function getGoodMarkFlag(): ?string |
||
348 | |||
349 | public function getLastDocId(): ?string |
||
353 | |||
354 | public function setProductName(?string $productName): FacadeMarkedProductsResponse |
||
359 | |||
360 | public function setOwnerName(?string $ownerName): self |
||
366 | |||
367 | public function setOwnerInn(?string $ownerInn): self |
||
373 | |||
374 | public function setAgentName(?string $agentName): FacadeMarkedProductsResponse |
||
379 | |||
380 | public function setAgentInn(?string $agentInn): FacadeMarkedProductsResponse |
||
385 | |||
386 | public function setIntroducedDate(?string $introducedDate): FacadeMarkedProductsResponse |
||
391 | |||
392 | public function setName(?string $name): FacadeMarkedProductsResponse |
||
397 | |||
398 | public function setBrand(?string $brand): FacadeMarkedProductsResponse |
||
403 | |||
404 | public function setModel(?string $model): FacadeMarkedProductsResponse |
||
409 | |||
410 | public function setCountry(?string $country): FacadeMarkedProductsResponse |
||
415 | |||
416 | public function setProductTypeDesc(?string $productTypeDesc): FacadeMarkedProductsResponse |
||
421 | |||
422 | public function setColor(?string $color): FacadeMarkedProductsResponse |
||
427 | |||
428 | public function setMaterialDown(?string $materialDown): FacadeMarkedProductsResponse |
||
433 | |||
434 | public function setMaterialUpper(?string $materialUpper): FacadeMarkedProductsResponse |
||
439 | |||
440 | public function setMaterialLining(?string $materialLining): FacadeMarkedProductsResponse |
||
445 | |||
446 | public function setGoodSignedFlag(?string $goodSignedFlag): FacadeMarkedProductsResponse |
||
451 | |||
452 | public function setGoodTurnFlag(?string $goodTurnFlag): FacadeMarkedProductsResponse |
||
457 | |||
458 | public function setGoodMarkFlag(?string $goodMarkFlag): FacadeMarkedProductsResponse |
||
463 | |||
464 | public function setLastDocId(?string $lastDocId): FacadeMarkedProductsResponse |
||
469 | } |
||
470 |