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 |
||
37 | * @SerializedName("ownerName") |
||
38 | */ |
||
39 | private $ownerName; |
||
40 | /** |
||
41 | * @var string |
||
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( |
||
196 | |||
197 | public function getCis(): string |
||
201 | |||
202 | public function getGtin(): string |
||
206 | |||
207 | public function getSgtin(): string |
||
211 | |||
212 | public function getProductName(): ?string |
||
216 | |||
217 | public function getOwnerName(): string |
||
221 | |||
222 | public function getOwnerInn(): string |
||
226 | |||
227 | public function getProducerName(): string |
||
231 | |||
232 | public function getProducerInn(): string |
||
236 | |||
237 | public function getAgentName(): ?string |
||
241 | |||
242 | public function getAgentInn(): ?string |
||
246 | |||
247 | public function getStatus(): string |
||
251 | |||
252 | public function getEmissionDate(): string |
||
256 | |||
257 | public function getEmissionType(): string |
||
261 | |||
262 | public function getIntroducedDate(): ?string |
||
266 | |||
267 | public function getName(): ?string |
||
271 | |||
272 | public function getBrand(): ?string |
||
276 | |||
277 | public function getModel(): ?string |
||
281 | |||
282 | /** |
||
283 | * @return FacadeMarkedProductsCertDoc[] |
||
284 | */ |
||
285 | public function getPrevCises(): array |
||
289 | |||
290 | /** |
||
291 | * @return FacadeMarkedProductsCertDoc[] |
||
292 | */ |
||
293 | public function getNextCises(): array |
||
297 | |||
298 | public function getCountry(): ?string |
||
302 | |||
303 | public function getProductTypeDesc(): ?string |
||
307 | |||
308 | public function getColor(): ?string |
||
312 | |||
313 | public function getMaterialDown(): ?string |
||
317 | |||
318 | public function getMaterialUpper(): ?string |
||
322 | |||
323 | public function getMaterialLining(): ?string |
||
327 | |||
328 | public function getPackType(): string |
||
332 | |||
333 | public function getCountChildren(): int |
||
337 | |||
338 | public function getGoodSignedFlag(): ?string |
||
342 | |||
343 | public function getGoodTurnFlag(): ?string |
||
347 | |||
348 | public function getGoodMarkFlag(): ?string |
||
352 | |||
353 | public function getLastDocId(): ?string |
||
357 | |||
358 | public function setProductName(?string $productName): FacadeMarkedProductsResponse |
||
363 | |||
364 | public function setAgentName(?string $agentName): FacadeMarkedProductsResponse |
||
369 | |||
370 | public function setAgentInn(?string $agentInn): FacadeMarkedProductsResponse |
||
375 | |||
376 | public function setIntroducedDate(?string $introducedDate): FacadeMarkedProductsResponse |
||
381 | |||
382 | public function setName(?string $name): FacadeMarkedProductsResponse |
||
387 | |||
388 | public function setBrand(?string $brand): FacadeMarkedProductsResponse |
||
393 | |||
394 | public function setModel(?string $model): FacadeMarkedProductsResponse |
||
399 | |||
400 | public function setCountry(?string $country): FacadeMarkedProductsResponse |
||
405 | |||
406 | public function setProductTypeDesc(?string $productTypeDesc): FacadeMarkedProductsResponse |
||
411 | |||
412 | public function setColor(?string $color): FacadeMarkedProductsResponse |
||
417 | |||
418 | public function setMaterialDown(?string $materialDown): FacadeMarkedProductsResponse |
||
423 | |||
424 | public function setMaterialUpper(?string $materialUpper): FacadeMarkedProductsResponse |
||
429 | |||
430 | public function setMaterialLining(?string $materialLining): FacadeMarkedProductsResponse |
||
435 | |||
436 | public function setGoodSignedFlag(?string $goodSignedFlag): FacadeMarkedProductsResponse |
||
441 | |||
442 | public function setGoodTurnFlag(?string $goodTurnFlag): FacadeMarkedProductsResponse |
||
447 | |||
448 | public function setGoodMarkFlag(?string $goodMarkFlag): FacadeMarkedProductsResponse |
||
453 | |||
454 | public function setLastDocId(?string $lastDocId): FacadeMarkedProductsResponse |
||
459 | } |
||
460 |