Complex classes like TAnonymousFunctionExpressionType 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 TAnonymousFunctionExpressionType, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
11 | class TAnonymousFunctionExpressionType |
||
12 | { |
||
13 | |||
14 | /** |
||
15 | * @property \MetadataV3\edm\TFunctionParameterType[] $parameters |
||
16 | */ |
||
17 | private $parameters = null; |
||
18 | |||
19 | /** |
||
20 | * @property string $string |
||
21 | */ |
||
22 | private $string = null; |
||
23 | |||
24 | /** |
||
25 | * @property mixed $binary |
||
26 | */ |
||
27 | private $binary = null; |
||
28 | |||
29 | /** |
||
30 | * @property integer $int |
||
31 | */ |
||
32 | private $int = null; |
||
33 | |||
34 | /** |
||
35 | * @property float $float |
||
36 | */ |
||
37 | private $float = null; |
||
38 | |||
39 | /** |
||
40 | * @property string $guid |
||
41 | */ |
||
42 | private $guid = null; |
||
43 | |||
44 | /** |
||
45 | * @property float $decimal |
||
46 | */ |
||
47 | private $decimal = null; |
||
48 | |||
49 | /** |
||
50 | * @property boolean $bool |
||
51 | */ |
||
52 | private $bool = null; |
||
53 | |||
54 | /** |
||
55 | * @property \DateTime $dateTime |
||
56 | */ |
||
57 | private $dateTime = null; |
||
58 | |||
59 | /** |
||
60 | * @property \DateTime $dateTimeOffset |
||
61 | */ |
||
62 | private $dateTimeOffset = null; |
||
63 | |||
64 | /** |
||
65 | * @property string $enum |
||
66 | */ |
||
67 | private $enum = null; |
||
68 | |||
69 | /** |
||
70 | * @property string $path |
||
71 | */ |
||
72 | private $path = null; |
||
73 | |||
74 | /** |
||
75 | * @property \MetadataV3\edm\TIfExpressionType $if |
||
76 | */ |
||
77 | private $if = null; |
||
78 | |||
79 | /** |
||
80 | * @property \MetadataV3\edm\TRecordExpressionType $record |
||
81 | */ |
||
82 | private $record = null; |
||
83 | |||
84 | /** |
||
85 | * @property \MetadataV3\edm\TCollectionExpressionType $collection |
||
86 | */ |
||
87 | private $collection = null; |
||
88 | |||
89 | /** |
||
90 | * @property \MetadataV3\edm\TTypeAssertExpressionType $typeAssert |
||
91 | */ |
||
92 | private $typeAssert = null; |
||
93 | |||
94 | /** |
||
95 | * @property \MetadataV3\edm\TTypeTestExpressionType $typeTest |
||
96 | */ |
||
97 | private $typeTest = null; |
||
98 | |||
99 | /** |
||
100 | * @property \MetadataV3\edm\TFunctionReferenceExpressionType $functionReference |
||
101 | */ |
||
102 | private $functionReference = null; |
||
103 | |||
104 | /** |
||
105 | * @property \MetadataV3\edm\TEntitySetReferenceExpressionType $entitySetReference |
||
106 | */ |
||
107 | private $entitySetReference = null; |
||
108 | |||
109 | /** |
||
110 | * @property \MetadataV3\edm\TAnonymousFunctionExpressionType $anonymousFunction |
||
111 | */ |
||
112 | private $anonymousFunction = null; |
||
113 | |||
114 | /** |
||
115 | * @property \MetadataV3\edm\TParameterReferenceExpressionType $parameterReference |
||
116 | */ |
||
117 | private $parameterReference = null; |
||
118 | |||
119 | /** |
||
120 | * @property \MetadataV3\edm\TApplyExpressionType $apply |
||
121 | */ |
||
122 | private $apply = null; |
||
123 | |||
124 | /** |
||
125 | * @property \MetadataV3\edm\TPropertyReferenceExpressionType $propertyReference |
||
126 | */ |
||
127 | private $propertyReference = null; |
||
128 | |||
129 | /** |
||
130 | * @property \MetadataV3\edm\TValueTermReferenceExpressionType $valueTermReference |
||
131 | */ |
||
132 | private $valueTermReference = null; |
||
133 | |||
134 | /** |
||
135 | * Adds as parameter |
||
136 | * |
||
137 | * @return self |
||
138 | * @param \MetadataV3\edm\TFunctionParameterType $parameter |
||
139 | */ |
||
140 | public function addToParameters(\MetadataV3\edm\TFunctionParameterType $parameter) |
||
145 | |||
146 | /** |
||
147 | * isset parameters |
||
148 | * |
||
149 | * @param scalar $index |
||
150 | * @return boolean |
||
151 | */ |
||
152 | public function issetParameters($index) |
||
156 | |||
157 | /** |
||
158 | * unset parameters |
||
159 | * |
||
160 | * @param scalar $index |
||
161 | * @return void |
||
162 | */ |
||
163 | public function unsetParameters($index) |
||
167 | |||
168 | /** |
||
169 | * Gets as parameters |
||
170 | * |
||
171 | * @return \MetadataV3\edm\TFunctionParameterType[] |
||
172 | */ |
||
173 | public function getParameters() |
||
177 | |||
178 | /** |
||
179 | * Sets a new parameters |
||
180 | * |
||
181 | * @param \MetadataV3\edm\TFunctionParameterType[] $parameters |
||
182 | * @return self |
||
183 | */ |
||
184 | public function setParameters(array $parameters) |
||
189 | |||
190 | /** |
||
191 | * Gets as string |
||
192 | * |
||
193 | * @return string |
||
194 | */ |
||
195 | public function getString() |
||
199 | |||
200 | /** |
||
201 | * Sets a new string |
||
202 | * |
||
203 | * @param string $string |
||
204 | * @return self |
||
205 | */ |
||
206 | public function setString($string) |
||
211 | |||
212 | /** |
||
213 | * Gets as binary |
||
214 | * |
||
215 | * @return mixed |
||
216 | */ |
||
217 | public function getBinary() |
||
221 | |||
222 | /** |
||
223 | * Sets a new binary |
||
224 | * |
||
225 | * @param mixed $binary |
||
226 | * @return self |
||
227 | */ |
||
228 | public function setBinary($binary) |
||
233 | |||
234 | /** |
||
235 | * Gets as int |
||
236 | * |
||
237 | * @return integer |
||
238 | */ |
||
239 | public function getInt() |
||
243 | |||
244 | /** |
||
245 | * Sets a new int |
||
246 | * |
||
247 | * @param integer $int |
||
248 | * @return self |
||
249 | */ |
||
250 | public function setInt($int) |
||
255 | |||
256 | /** |
||
257 | * Gets as float |
||
258 | * |
||
259 | * @return float |
||
260 | */ |
||
261 | public function getFloat() |
||
265 | |||
266 | /** |
||
267 | * Sets a new float |
||
268 | * |
||
269 | * @param float $float |
||
270 | * @return self |
||
271 | */ |
||
272 | public function setFloat($float) |
||
277 | |||
278 | /** |
||
279 | * Gets as guid |
||
280 | * |
||
281 | * @return string |
||
282 | */ |
||
283 | public function getGuid() |
||
287 | |||
288 | /** |
||
289 | * Sets a new guid |
||
290 | * |
||
291 | * @param string $guid |
||
292 | * @return self |
||
293 | */ |
||
294 | public function setGuid($guid) |
||
299 | |||
300 | /** |
||
301 | * Gets as decimal |
||
302 | * |
||
303 | * @return float |
||
304 | */ |
||
305 | public function getDecimal() |
||
309 | |||
310 | /** |
||
311 | * Sets a new decimal |
||
312 | * |
||
313 | * @param float $decimal |
||
314 | * @return self |
||
315 | */ |
||
316 | public function setDecimal($decimal) |
||
321 | |||
322 | /** |
||
323 | * Gets as bool |
||
324 | * |
||
325 | * @return boolean |
||
326 | */ |
||
327 | public function getBool() |
||
331 | |||
332 | /** |
||
333 | * Sets a new bool |
||
334 | * |
||
335 | * @param boolean $bool |
||
336 | * @return self |
||
337 | */ |
||
338 | public function setBool($bool) |
||
343 | |||
344 | /** |
||
345 | * Gets as dateTime |
||
346 | * |
||
347 | * @return \DateTime |
||
348 | */ |
||
349 | public function getDateTime() |
||
353 | |||
354 | /** |
||
355 | * Sets a new dateTime |
||
356 | * |
||
357 | * @param \DateTime $dateTime |
||
358 | * @return self |
||
359 | */ |
||
360 | public function setDateTime(\DateTime $dateTime) |
||
365 | |||
366 | /** |
||
367 | * Gets as dateTimeOffset |
||
368 | * |
||
369 | * @return \DateTime |
||
370 | */ |
||
371 | public function getDateTimeOffset() |
||
375 | |||
376 | /** |
||
377 | * Sets a new dateTimeOffset |
||
378 | * |
||
379 | * @param \DateTime $dateTimeOffset |
||
380 | * @return self |
||
381 | */ |
||
382 | public function setDateTimeOffset(\DateTime $dateTimeOffset) |
||
387 | |||
388 | /** |
||
389 | * Gets as enum |
||
390 | * |
||
391 | * @return string |
||
392 | */ |
||
393 | public function getEnum() |
||
397 | |||
398 | /** |
||
399 | * Sets a new enum |
||
400 | * |
||
401 | * @param string $enum |
||
402 | * @return self |
||
403 | */ |
||
404 | public function setEnum($enum) |
||
409 | |||
410 | /** |
||
411 | * Gets as path |
||
412 | * |
||
413 | * @return string |
||
414 | */ |
||
415 | public function getPath() |
||
419 | |||
420 | /** |
||
421 | * Sets a new path |
||
422 | * |
||
423 | * @param string $path |
||
424 | * @return self |
||
425 | */ |
||
426 | public function setPath($path) |
||
431 | |||
432 | /** |
||
433 | * Gets as if |
||
434 | * |
||
435 | * @return \MetadataV3\edm\TIfExpressionType |
||
436 | */ |
||
437 | public function getIf() |
||
441 | |||
442 | /** |
||
443 | * Sets a new if |
||
444 | * |
||
445 | * @param \MetadataV3\edm\TIfExpressionType $if |
||
446 | * @return self |
||
447 | */ |
||
448 | public function setIf(\MetadataV3\edm\TIfExpressionType $if) |
||
453 | |||
454 | /** |
||
455 | * Gets as record |
||
456 | * |
||
457 | * @return \MetadataV3\edm\TRecordExpressionType |
||
458 | */ |
||
459 | public function getRecord() |
||
463 | |||
464 | /** |
||
465 | * Sets a new record |
||
466 | * |
||
467 | * @param \MetadataV3\edm\TRecordExpressionType $record |
||
468 | * @return self |
||
469 | */ |
||
470 | public function setRecord(\MetadataV3\edm\TRecordExpressionType $record) |
||
475 | |||
476 | /** |
||
477 | * Gets as collection |
||
478 | * |
||
479 | * @return \MetadataV3\edm\TCollectionExpressionType |
||
480 | */ |
||
481 | public function getCollection() |
||
485 | |||
486 | /** |
||
487 | * Sets a new collection |
||
488 | * |
||
489 | * @param \MetadataV3\edm\TCollectionExpressionType $collection |
||
490 | * @return self |
||
491 | */ |
||
492 | public function setCollection(\MetadataV3\edm\TCollectionExpressionType $collection) |
||
497 | |||
498 | /** |
||
499 | * Gets as typeAssert |
||
500 | * |
||
501 | * @return \MetadataV3\edm\TTypeAssertExpressionType |
||
502 | */ |
||
503 | public function getTypeAssert() |
||
507 | |||
508 | /** |
||
509 | * Sets a new typeAssert |
||
510 | * |
||
511 | * @param \MetadataV3\edm\TTypeAssertExpressionType $typeAssert |
||
512 | * @return self |
||
513 | */ |
||
514 | public function setTypeAssert(\MetadataV3\edm\TTypeAssertExpressionType $typeAssert) |
||
519 | |||
520 | /** |
||
521 | * Gets as typeTest |
||
522 | * |
||
523 | * @return \MetadataV3\edm\TTypeTestExpressionType |
||
524 | */ |
||
525 | public function getTypeTest() |
||
529 | |||
530 | /** |
||
531 | * Sets a new typeTest |
||
532 | * |
||
533 | * @param \MetadataV3\edm\TTypeTestExpressionType $typeTest |
||
534 | * @return self |
||
535 | */ |
||
536 | public function setTypeTest(\MetadataV3\edm\TTypeTestExpressionType $typeTest) |
||
541 | |||
542 | /** |
||
543 | * Gets as functionReference |
||
544 | * |
||
545 | * @return \MetadataV3\edm\TFunctionReferenceExpressionType |
||
546 | */ |
||
547 | public function getFunctionReference() |
||
551 | |||
552 | /** |
||
553 | * Sets a new functionReference |
||
554 | * |
||
555 | * @param \MetadataV3\edm\TFunctionReferenceExpressionType $functionReference |
||
556 | * @return self |
||
557 | */ |
||
558 | public function setFunctionReference(\MetadataV3\edm\TFunctionReferenceExpressionType $functionReference) |
||
563 | |||
564 | /** |
||
565 | * Gets as entitySetReference |
||
566 | * |
||
567 | * @return \MetadataV3\edm\TEntitySetReferenceExpressionType |
||
568 | */ |
||
569 | public function getEntitySetReference() |
||
573 | |||
574 | /** |
||
575 | * Sets a new entitySetReference |
||
576 | * |
||
577 | * @param \MetadataV3\edm\TEntitySetReferenceExpressionType $entitySetReference |
||
578 | * @return self |
||
579 | */ |
||
580 | public function setEntitySetReference(\MetadataV3\edm\TEntitySetReferenceExpressionType $entitySetReference) |
||
585 | |||
586 | /** |
||
587 | * Gets as anonymousFunction |
||
588 | * |
||
589 | * @return \MetadataV3\edm\TAnonymousFunctionExpressionType |
||
590 | */ |
||
591 | public function getAnonymousFunction() |
||
595 | |||
596 | /** |
||
597 | * Sets a new anonymousFunction |
||
598 | * |
||
599 | * @param \MetadataV3\edm\TAnonymousFunctionExpressionType $anonymousFunction |
||
600 | * @return self |
||
601 | */ |
||
602 | public function setAnonymousFunction(\MetadataV3\edm\TAnonymousFunctionExpressionType $anonymousFunction) |
||
607 | |||
608 | /** |
||
609 | * Gets as parameterReference |
||
610 | * |
||
611 | * @return \MetadataV3\edm\TParameterReferenceExpressionType |
||
612 | */ |
||
613 | public function getParameterReference() |
||
617 | |||
618 | /** |
||
619 | * Sets a new parameterReference |
||
620 | * |
||
621 | * @param \MetadataV3\edm\TParameterReferenceExpressionType $parameterReference |
||
622 | * @return self |
||
623 | */ |
||
624 | public function setParameterReference(\MetadataV3\edm\TParameterReferenceExpressionType $parameterReference) |
||
629 | |||
630 | /** |
||
631 | * Gets as apply |
||
632 | * |
||
633 | * @return \MetadataV3\edm\TApplyExpressionType |
||
634 | */ |
||
635 | public function getApply() |
||
639 | |||
640 | /** |
||
641 | * Sets a new apply |
||
642 | * |
||
643 | * @param \MetadataV3\edm\TApplyExpressionType $apply |
||
644 | * @return self |
||
645 | */ |
||
646 | public function setApply(\MetadataV3\edm\TApplyExpressionType $apply) |
||
651 | |||
652 | /** |
||
653 | * Gets as propertyReference |
||
654 | * |
||
655 | * @return \MetadataV3\edm\TPropertyReferenceExpressionType |
||
656 | */ |
||
657 | public function getPropertyReference() |
||
661 | |||
662 | /** |
||
663 | * Sets a new propertyReference |
||
664 | * |
||
665 | * @param \MetadataV3\edm\TPropertyReferenceExpressionType $propertyReference |
||
666 | * @return self |
||
667 | */ |
||
668 | public function setPropertyReference(\MetadataV3\edm\TPropertyReferenceExpressionType $propertyReference) |
||
673 | |||
674 | /** |
||
675 | * Gets as valueTermReference |
||
676 | * |
||
677 | * @return \MetadataV3\edm\TValueTermReferenceExpressionType |
||
678 | */ |
||
679 | public function getValueTermReference() |
||
683 | |||
684 | /** |
||
685 | * Sets a new valueTermReference |
||
686 | * |
||
687 | * @param \MetadataV3\edm\TValueTermReferenceExpressionType $valueTermReference |
||
688 | * @return self |
||
689 | */ |
||
690 | public function setValueTermReference(\MetadataV3\edm\TValueTermReferenceExpressionType $valueTermReference) |
||
695 | } |
||
696 |