Complex classes like TSchemaType 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 TSchemaType, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
13 | class TSchemaType extends IsOK |
||
|
|||
14 | { |
||
15 | |||
16 | /** |
||
17 | * @property string $namespace |
||
18 | */ |
||
19 | private $namespace = null; |
||
20 | |||
21 | /** |
||
22 | * @property string $namespaceUri |
||
23 | */ |
||
24 | private $namespaceUri = null; |
||
25 | |||
26 | /** |
||
27 | * @property string $alias |
||
28 | */ |
||
29 | private $alias = null; |
||
30 | |||
31 | /** |
||
32 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TUsingType[] $using |
||
33 | */ |
||
34 | private $using = array(); |
||
35 | |||
36 | /** |
||
37 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TAssociationType[] $association |
||
38 | */ |
||
39 | private $association = array(); |
||
40 | |||
41 | /** |
||
42 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TComplexTypeType[] $complexType |
||
43 | */ |
||
44 | private $complexType = array(); |
||
45 | |||
46 | /** |
||
47 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityTypeType[] $entityType |
||
48 | */ |
||
49 | private $entityType = array(); |
||
50 | |||
51 | /** |
||
52 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TEnumTypeType[] $enumType |
||
53 | */ |
||
54 | private $enumType = array(); |
||
55 | |||
56 | /** |
||
57 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueTermType[] $valueTerm |
||
58 | */ |
||
59 | private $valueTerm = array(); |
||
60 | |||
61 | /** |
||
62 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionType[] $function |
||
63 | */ |
||
64 | private $function = array(); |
||
65 | |||
66 | /** |
||
67 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TAnnotationsType[] $annotations |
||
68 | */ |
||
69 | private $annotations = array(); |
||
70 | |||
71 | /** |
||
72 | * @property \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer[] $entityContainer |
||
73 | */ |
||
74 | private $entityContainer = array(); |
||
75 | |||
76 | /** |
||
77 | * Gets as namespace |
||
78 | * |
||
79 | * @return string |
||
80 | */ |
||
81 | public function getNamespace() |
||
85 | |||
86 | /** |
||
87 | * Sets a new namespace |
||
88 | * |
||
89 | * @param string $namespace |
||
90 | * @return self |
||
91 | */ |
||
92 | public function setNamespace($namespace) |
||
97 | |||
98 | /** |
||
99 | * Gets as namespaceUri |
||
100 | * |
||
101 | * @return string |
||
102 | */ |
||
103 | public function getNamespaceUri() |
||
107 | |||
108 | /** |
||
109 | * Sets a new namespaceUri |
||
110 | * |
||
111 | * @param string $namespaceUri |
||
112 | * @return self |
||
113 | */ |
||
114 | public function setNamespaceUri($namespaceUri) |
||
119 | |||
120 | /** |
||
121 | * Gets as alias |
||
122 | * |
||
123 | * @return string |
||
124 | */ |
||
125 | public function getAlias() |
||
129 | |||
130 | /** |
||
131 | * Sets a new alias |
||
132 | * |
||
133 | * @param string $alias |
||
134 | * @return self |
||
135 | */ |
||
136 | public function setAlias($alias) |
||
141 | |||
142 | /** |
||
143 | * Adds as using |
||
144 | * |
||
145 | * @return self |
||
146 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TUsingType $using |
||
147 | */ |
||
148 | public function addToUsing(TUsingType $using) |
||
153 | |||
154 | /** |
||
155 | * isset using |
||
156 | * |
||
157 | * @param scalar $index |
||
158 | * @return boolean |
||
159 | */ |
||
160 | public function issetUsing($index) |
||
164 | |||
165 | /** |
||
166 | * unset using |
||
167 | * |
||
168 | * @param scalar $index |
||
169 | * @return void |
||
170 | */ |
||
171 | public function unsetUsing($index) |
||
175 | |||
176 | /** |
||
177 | * Gets as using |
||
178 | * |
||
179 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TUsingType[] |
||
180 | */ |
||
181 | public function getUsing() |
||
185 | |||
186 | /** |
||
187 | * Sets a new using |
||
188 | * |
||
189 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TUsingType[] $using |
||
190 | * @return self |
||
191 | */ |
||
192 | public function setUsing(array $using) |
||
197 | |||
198 | /** |
||
199 | * Adds as association |
||
200 | * |
||
201 | * @return self |
||
202 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TAssociationType $association |
||
203 | */ |
||
204 | public function addToAssociation(TAssociationType $association) |
||
209 | |||
210 | /** |
||
211 | * isset association |
||
212 | * |
||
213 | * @param scalar $index |
||
214 | * @return boolean |
||
215 | */ |
||
216 | public function issetAssociation($index) |
||
220 | |||
221 | /** |
||
222 | * unset association |
||
223 | * |
||
224 | * @param scalar $index |
||
225 | * @return void |
||
226 | */ |
||
227 | public function unsetAssociation($index) |
||
231 | |||
232 | /** |
||
233 | * Gets as association |
||
234 | * |
||
235 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TAssociationType[] |
||
236 | */ |
||
237 | public function getAssociation() |
||
241 | |||
242 | /** |
||
243 | * Sets a new association |
||
244 | * |
||
245 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TAssociationType[] $association |
||
246 | * @return self |
||
247 | */ |
||
248 | public function setAssociation(array $association) |
||
253 | |||
254 | /** |
||
255 | * Adds as complexType |
||
256 | * |
||
257 | * @return self |
||
258 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TComplexTypeType $complexType |
||
259 | */ |
||
260 | public function addToComplexType(TComplexTypeType $complexType) |
||
265 | |||
266 | /** |
||
267 | * isset complexType |
||
268 | * |
||
269 | * @param scalar $index |
||
270 | * @return boolean |
||
271 | */ |
||
272 | public function issetComplexType($index) |
||
276 | |||
277 | /** |
||
278 | * unset complexType |
||
279 | * |
||
280 | * @param scalar $index |
||
281 | * @return void |
||
282 | */ |
||
283 | public function unsetComplexType($index) |
||
287 | |||
288 | /** |
||
289 | * Gets as complexType |
||
290 | * |
||
291 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TComplexTypeType[] |
||
292 | */ |
||
293 | public function getComplexType() |
||
297 | |||
298 | /** |
||
299 | * Sets a new complexType |
||
300 | * |
||
301 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TComplexTypeType[] $complexType |
||
302 | * @return self |
||
303 | */ |
||
304 | public function setComplexType(array $complexType) |
||
309 | |||
310 | /** |
||
311 | * Adds as entityType |
||
312 | * |
||
313 | * @return self |
||
314 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityTypeType $entityType |
||
315 | */ |
||
316 | public function addToEntityType(TEntityTypeType $entityType) |
||
321 | |||
322 | /** |
||
323 | * isset entityType |
||
324 | * |
||
325 | * @param scalar $index |
||
326 | * @return boolean |
||
327 | */ |
||
328 | public function issetEntityType($index) |
||
332 | |||
333 | /** |
||
334 | * unset entityType |
||
335 | * |
||
336 | * @param scalar $index |
||
337 | * @return void |
||
338 | */ |
||
339 | public function unsetEntityType($index) |
||
343 | |||
344 | /** |
||
345 | * Gets as entityType |
||
346 | * |
||
347 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityTypeType[] |
||
348 | */ |
||
349 | public function getEntityType() |
||
353 | |||
354 | /** |
||
355 | * Sets a new entityType |
||
356 | * |
||
357 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityTypeType[] $entityType |
||
358 | * @return self |
||
359 | */ |
||
360 | public function setEntityType(array $entityType) |
||
365 | |||
366 | /** |
||
367 | * Adds as enumType |
||
368 | * |
||
369 | * @return self |
||
370 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TEnumTypeType $enumType |
||
371 | */ |
||
372 | public function addToEnumType(TEnumTypeType $enumType) |
||
377 | |||
378 | /** |
||
379 | * isset enumType |
||
380 | * |
||
381 | * @param scalar $index |
||
382 | * @return boolean |
||
383 | */ |
||
384 | public function issetEnumType($index) |
||
388 | |||
389 | /** |
||
390 | * unset enumType |
||
391 | * |
||
392 | * @param scalar $index |
||
393 | * @return void |
||
394 | */ |
||
395 | public function unsetEnumType($index) |
||
399 | |||
400 | /** |
||
401 | * Gets as enumType |
||
402 | * |
||
403 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TEnumTypeType[] |
||
404 | */ |
||
405 | public function getEnumType() |
||
409 | |||
410 | /** |
||
411 | * Sets a new enumType |
||
412 | * |
||
413 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TEnumTypeType[] $enumType |
||
414 | * @return self |
||
415 | */ |
||
416 | public function setEnumType(array $enumType) |
||
421 | |||
422 | /** |
||
423 | * Adds as valueTerm |
||
424 | * |
||
425 | * @return self |
||
426 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueTermType $valueTerm |
||
427 | */ |
||
428 | public function addToValueTerm(TValueTermType $valueTerm) |
||
433 | |||
434 | /** |
||
435 | * isset valueTerm |
||
436 | * |
||
437 | * @param scalar $index |
||
438 | * @return boolean |
||
439 | */ |
||
440 | public function issetValueTerm($index) |
||
444 | |||
445 | /** |
||
446 | * unset valueTerm |
||
447 | * |
||
448 | * @param scalar $index |
||
449 | * @return void |
||
450 | */ |
||
451 | public function unsetValueTerm($index) |
||
455 | |||
456 | /** |
||
457 | * Gets as valueTerm |
||
458 | * |
||
459 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueTermType[] |
||
460 | */ |
||
461 | public function getValueTerm() |
||
465 | |||
466 | /** |
||
467 | * Sets a new valueTerm |
||
468 | * |
||
469 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueTermType[] $valueTerm |
||
470 | * @return self |
||
471 | */ |
||
472 | public function setValueTerm(array $valueTerm) |
||
477 | |||
478 | /** |
||
479 | * Adds as function |
||
480 | * |
||
481 | * @return self |
||
482 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionType $function |
||
483 | */ |
||
484 | public function addToFunction(TFunctionType $function) |
||
489 | |||
490 | /** |
||
491 | * isset function |
||
492 | * |
||
493 | * @param scalar $index |
||
494 | * @return boolean |
||
495 | */ |
||
496 | public function issetFunction($index) |
||
500 | |||
501 | /** |
||
502 | * unset function |
||
503 | * |
||
504 | * @param scalar $index |
||
505 | * @return void |
||
506 | */ |
||
507 | public function unsetFunction($index) |
||
511 | |||
512 | /** |
||
513 | * Gets as function |
||
514 | * |
||
515 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionType[] |
||
516 | */ |
||
517 | public function getFunction() |
||
521 | |||
522 | /** |
||
523 | * Sets a new function |
||
524 | * |
||
525 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionType[] $function |
||
526 | * @return self |
||
527 | */ |
||
528 | public function setFunction(array $function) |
||
533 | |||
534 | /** |
||
535 | * Adds as annotations |
||
536 | * |
||
537 | * @return self |
||
538 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TAnnotationsType $annotations |
||
539 | */ |
||
540 | public function addToAnnotations(TAnnotationsType $annotations) |
||
545 | |||
546 | /** |
||
547 | * isset annotations |
||
548 | * |
||
549 | * @param scalar $index |
||
550 | * @return boolean |
||
551 | */ |
||
552 | public function issetAnnotations($index) |
||
556 | |||
557 | /** |
||
558 | * unset annotations |
||
559 | * |
||
560 | * @param scalar $index |
||
561 | * @return void |
||
562 | */ |
||
563 | public function unsetAnnotations($index) |
||
567 | |||
568 | /** |
||
569 | * Gets as annotations |
||
570 | * |
||
571 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TAnnotationsType[] |
||
572 | */ |
||
573 | public function getAnnotations() |
||
577 | |||
578 | /** |
||
579 | * Sets a new annotations |
||
580 | * |
||
581 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TAnnotationsType[] $annotations |
||
582 | * @return self |
||
583 | */ |
||
584 | public function setAnnotations(array $annotations) |
||
589 | |||
590 | /** |
||
591 | * Adds as entityContainer |
||
592 | * |
||
593 | * @return self |
||
594 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer $entityContainer |
||
595 | */ |
||
596 | public function addToEntityContainer(EntityContainer $entityContainer) |
||
601 | |||
602 | /** |
||
603 | * isset entityContainer |
||
604 | * |
||
605 | * @param scalar $index |
||
606 | * @return boolean |
||
607 | */ |
||
608 | public function issetEntityContainer($index) |
||
612 | |||
613 | /** |
||
614 | * unset entityContainer |
||
615 | * |
||
616 | * @param scalar $index |
||
617 | * @return void |
||
618 | */ |
||
619 | public function unsetEntityContainer($index) |
||
623 | |||
624 | /** |
||
625 | * Gets as entityContainer |
||
626 | * |
||
627 | * @return \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer[] |
||
628 | */ |
||
629 | public function getEntityContainer() |
||
633 | |||
634 | /** |
||
635 | * Sets a new entityContainer |
||
636 | * |
||
637 | * @param \AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer[] $entityContainer |
||
638 | * @return self |
||
639 | */ |
||
640 | public function setEntityContainer(array $entityContainer) |
||
645 | } |
||
646 |