Complex classes like FeedType 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 FeedType, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
11 | class FeedType |
||
12 | { |
||
13 | |||
14 | /** |
||
15 | * @property string $base |
||
16 | */ |
||
17 | private $base = null; |
||
18 | |||
19 | /** |
||
20 | * @property string $lang |
||
21 | */ |
||
22 | private $lang = null; |
||
23 | |||
24 | /** |
||
25 | * @property \AlgoWeb\ODataMetadata\Atom\Author[] $author |
||
26 | */ |
||
27 | private $author = array( |
||
28 | |||
29 | ); |
||
30 | |||
31 | /** |
||
32 | * @property \AlgoWeb\ODataMetadata\Atom\Category[] $category |
||
33 | */ |
||
34 | private $category = array( |
||
35 | |||
36 | ); |
||
37 | |||
38 | /** |
||
39 | * @property \AlgoWeb\ODataMetadata\Atom\Contributor[] $contributor |
||
40 | */ |
||
41 | private $contributor = array( |
||
42 | |||
43 | ); |
||
44 | |||
45 | /** |
||
46 | * @property \AlgoWeb\ODataMetadata\Atom\Generator[] $generator |
||
47 | */ |
||
48 | private $generator = array( |
||
49 | |||
50 | ); |
||
51 | |||
52 | /** |
||
53 | * @property \AlgoWeb\ODataMetadata\Atom\Icon[] $icon |
||
54 | */ |
||
55 | private $icon = array( |
||
56 | |||
57 | ); |
||
58 | |||
59 | /** |
||
60 | * @property \AlgoWeb\ODataMetadata\Atom\Id[] $id |
||
61 | */ |
||
62 | private $id = array( |
||
63 | |||
64 | ); |
||
65 | |||
66 | /** |
||
67 | * @property \AlgoWeb\ODataMetadata\Atom\Link[] $link |
||
68 | */ |
||
69 | private $link = array( |
||
70 | |||
71 | ); |
||
72 | |||
73 | /** |
||
74 | * @property \AlgoWeb\ODataMetadata\Atom\Logo[] $logo |
||
75 | */ |
||
76 | private $logo = array( |
||
77 | |||
78 | ); |
||
79 | |||
80 | /** |
||
81 | * @property \AlgoWeb\ODataMetadata\Atom\Rights[] $rights |
||
82 | */ |
||
83 | private $rights = array( |
||
84 | |||
85 | ); |
||
86 | |||
87 | /** |
||
88 | * @property \AlgoWeb\ODataMetadata\Atom\Subtitle[] $subtitle |
||
89 | */ |
||
90 | private $subtitle = array( |
||
91 | |||
92 | ); |
||
93 | |||
94 | /** |
||
95 | * @property \AlgoWeb\ODataMetadata\Atom\Title[] $title |
||
96 | */ |
||
97 | private $title = array( |
||
98 | |||
99 | ); |
||
100 | |||
101 | /** |
||
102 | * @property \AlgoWeb\ODataMetadata\Atom\Updated[] $updated |
||
103 | */ |
||
104 | private $updated = array( |
||
105 | |||
106 | ); |
||
107 | |||
108 | /** |
||
109 | * @property \AlgoWeb\ODataMetadata\Atom\Entry[] $entry |
||
110 | */ |
||
111 | private $entry = array( |
||
112 | |||
113 | ); |
||
114 | |||
115 | /** |
||
116 | * Gets as base |
||
117 | * |
||
118 | * @return string |
||
119 | */ |
||
120 | public function getBase() |
||
124 | |||
125 | /** |
||
126 | * Sets a new base |
||
127 | * |
||
128 | * @param string $base |
||
129 | * @return self |
||
130 | */ |
||
131 | public function setBase($base) |
||
136 | |||
137 | /** |
||
138 | * Gets as lang |
||
139 | * |
||
140 | * @return string |
||
141 | */ |
||
142 | public function getLang() |
||
146 | |||
147 | /** |
||
148 | * Sets a new lang |
||
149 | * |
||
150 | * @param string $lang |
||
151 | * @return self |
||
152 | */ |
||
153 | public function setLang($lang) |
||
158 | |||
159 | /** |
||
160 | * Adds as author |
||
161 | * |
||
162 | * @return self |
||
163 | * @param \AlgoWeb\ODataMetadata\Atom\Author $author |
||
164 | */ |
||
165 | public function addToAuthor(\AlgoWeb\ODataMetadata\Atom\Author $author) |
||
170 | |||
171 | /** |
||
172 | * isset author |
||
173 | * |
||
174 | * @param scalar $index |
||
175 | * @return boolean |
||
176 | */ |
||
177 | public function issetAuthor($index) |
||
181 | |||
182 | /** |
||
183 | * unset author |
||
184 | * |
||
185 | * @param scalar $index |
||
186 | * @return void |
||
187 | */ |
||
188 | public function unsetAuthor($index) |
||
192 | |||
193 | /** |
||
194 | * Gets as author |
||
195 | * |
||
196 | * @return \AlgoWeb\ODataMetadata\Atom\Author[] |
||
197 | */ |
||
198 | public function getAuthor() |
||
202 | |||
203 | /** |
||
204 | * Sets a new author |
||
205 | * |
||
206 | * @param \AlgoWeb\ODataMetadata\Atom\Author[] $author |
||
207 | * @return self |
||
208 | */ |
||
209 | public function setAuthor(array $author) |
||
214 | |||
215 | /** |
||
216 | * Adds as category |
||
217 | * |
||
218 | * @return self |
||
219 | * @param \AlgoWeb\ODataMetadata\Atom\Category $category |
||
220 | */ |
||
221 | public function addToCategory(\AlgoWeb\ODataMetadata\Atom\Category $category) |
||
226 | |||
227 | /** |
||
228 | * isset category |
||
229 | * |
||
230 | * @param scalar $index |
||
231 | * @return boolean |
||
232 | */ |
||
233 | public function issetCategory($index) |
||
237 | |||
238 | /** |
||
239 | * unset category |
||
240 | * |
||
241 | * @param scalar $index |
||
242 | * @return void |
||
243 | */ |
||
244 | public function unsetCategory($index) |
||
248 | |||
249 | /** |
||
250 | * Gets as category |
||
251 | * |
||
252 | * @return \AlgoWeb\ODataMetadata\Atom\Category[] |
||
253 | */ |
||
254 | public function getCategory() |
||
258 | |||
259 | /** |
||
260 | * Sets a new category |
||
261 | * |
||
262 | * @param \AlgoWeb\ODataMetadata\Atom\Category[] $category |
||
263 | * @return self |
||
264 | */ |
||
265 | public function setCategory(array $category) |
||
270 | |||
271 | /** |
||
272 | * Adds as contributor |
||
273 | * |
||
274 | * @return self |
||
275 | * @param \AlgoWeb\ODataMetadata\Atom\Contributor $contributor |
||
276 | */ |
||
277 | public function addToContributor(\AlgoWeb\ODataMetadata\Atom\Contributor $contributor) |
||
282 | |||
283 | /** |
||
284 | * isset contributor |
||
285 | * |
||
286 | * @param scalar $index |
||
287 | * @return boolean |
||
288 | */ |
||
289 | public function issetContributor($index) |
||
293 | |||
294 | /** |
||
295 | * unset contributor |
||
296 | * |
||
297 | * @param scalar $index |
||
298 | * @return void |
||
299 | */ |
||
300 | public function unsetContributor($index) |
||
304 | |||
305 | /** |
||
306 | * Gets as contributor |
||
307 | * |
||
308 | * @return \AlgoWeb\ODataMetadata\Atom\Contributor[] |
||
309 | */ |
||
310 | public function getContributor() |
||
314 | |||
315 | /** |
||
316 | * Sets a new contributor |
||
317 | * |
||
318 | * @param \AlgoWeb\ODataMetadata\Atom\Contributor[] $contributor |
||
319 | * @return self |
||
320 | */ |
||
321 | public function setContributor(array $contributor) |
||
326 | |||
327 | /** |
||
328 | * Adds as generator |
||
329 | * |
||
330 | * @return self |
||
331 | * @param \AlgoWeb\ODataMetadata\Atom\Generator $generator |
||
332 | */ |
||
333 | public function addToGenerator(\AlgoWeb\ODataMetadata\Atom\Generator $generator) |
||
338 | |||
339 | /** |
||
340 | * isset generator |
||
341 | * |
||
342 | * @param scalar $index |
||
343 | * @return boolean |
||
344 | */ |
||
345 | public function issetGenerator($index) |
||
349 | |||
350 | /** |
||
351 | * unset generator |
||
352 | * |
||
353 | * @param scalar $index |
||
354 | * @return void |
||
355 | */ |
||
356 | public function unsetGenerator($index) |
||
360 | |||
361 | /** |
||
362 | * Gets as generator |
||
363 | * |
||
364 | * @return \AlgoWeb\ODataMetadata\Atom\Generator[] |
||
365 | */ |
||
366 | public function getGenerator() |
||
370 | |||
371 | /** |
||
372 | * Sets a new generator |
||
373 | * |
||
374 | * @param \AlgoWeb\ODataMetadata\Atom\Generator[] $generator |
||
375 | * @return self |
||
376 | */ |
||
377 | public function setGenerator(array $generator) |
||
382 | |||
383 | /** |
||
384 | * Adds as icon |
||
385 | * |
||
386 | * @return self |
||
387 | * @param \AlgoWeb\ODataMetadata\Atom\Icon $icon |
||
388 | */ |
||
389 | public function addToIcon(\AlgoWeb\ODataMetadata\Atom\Icon $icon) |
||
394 | |||
395 | /** |
||
396 | * isset icon |
||
397 | * |
||
398 | * @param scalar $index |
||
399 | * @return boolean |
||
400 | */ |
||
401 | public function issetIcon($index) |
||
405 | |||
406 | /** |
||
407 | * unset icon |
||
408 | * |
||
409 | * @param scalar $index |
||
410 | * @return void |
||
411 | */ |
||
412 | public function unsetIcon($index) |
||
416 | |||
417 | /** |
||
418 | * Gets as icon |
||
419 | * |
||
420 | * @return \AlgoWeb\ODataMetadata\Atom\Icon[] |
||
421 | */ |
||
422 | public function getIcon() |
||
426 | |||
427 | /** |
||
428 | * Sets a new icon |
||
429 | * |
||
430 | * @param \AlgoWeb\ODataMetadata\Atom\Icon[] $icon |
||
431 | * @return self |
||
432 | */ |
||
433 | public function setIcon(array $icon) |
||
438 | |||
439 | /** |
||
440 | * Adds as id |
||
441 | * |
||
442 | * @return self |
||
443 | * @param \AlgoWeb\ODataMetadata\Atom\Id $id |
||
444 | */ |
||
445 | public function addToId(\AlgoWeb\ODataMetadata\Atom\Id $id) |
||
450 | |||
451 | /** |
||
452 | * isset id |
||
453 | * |
||
454 | * @param scalar $index |
||
455 | * @return boolean |
||
456 | */ |
||
457 | public function issetId($index) |
||
461 | |||
462 | /** |
||
463 | * unset id |
||
464 | * |
||
465 | * @param scalar $index |
||
466 | * @return void |
||
467 | */ |
||
468 | public function unsetId($index) |
||
472 | |||
473 | /** |
||
474 | * Gets as id |
||
475 | * |
||
476 | * @return \AlgoWeb\ODataMetadata\Atom\Id[] |
||
477 | */ |
||
478 | public function getId() |
||
482 | |||
483 | /** |
||
484 | * Sets a new id |
||
485 | * |
||
486 | * @param \AlgoWeb\ODataMetadata\Atom\Id[] $id |
||
487 | * @return self |
||
488 | */ |
||
489 | public function setId(array $id) |
||
494 | |||
495 | /** |
||
496 | * Adds as link |
||
497 | * |
||
498 | * @return self |
||
499 | * @param \AlgoWeb\ODataMetadata\Atom\Link $link |
||
500 | */ |
||
501 | public function addToLink(\AlgoWeb\ODataMetadata\Atom\Link $link) |
||
506 | |||
507 | /** |
||
508 | * isset link |
||
509 | * |
||
510 | * @param scalar $index |
||
511 | * @return boolean |
||
512 | */ |
||
513 | public function issetLink($index) |
||
517 | |||
518 | /** |
||
519 | * unset link |
||
520 | * |
||
521 | * @param scalar $index |
||
522 | * @return void |
||
523 | */ |
||
524 | public function unsetLink($index) |
||
528 | |||
529 | /** |
||
530 | * Gets as link |
||
531 | * |
||
532 | * @return \AlgoWeb\ODataMetadata\Atom\Link[] |
||
533 | */ |
||
534 | public function getLink() |
||
538 | |||
539 | /** |
||
540 | * Sets a new link |
||
541 | * |
||
542 | * @param \AlgoWeb\ODataMetadata\Atom\Link[] $link |
||
543 | * @return self |
||
544 | */ |
||
545 | public function setLink(array $link) |
||
550 | |||
551 | /** |
||
552 | * Adds as logo |
||
553 | * |
||
554 | * @return self |
||
555 | * @param \AlgoWeb\ODataMetadata\Atom\Logo $logo |
||
556 | */ |
||
557 | public function addToLogo(\AlgoWeb\ODataMetadata\Atom\Logo $logo) |
||
562 | |||
563 | /** |
||
564 | * isset logo |
||
565 | * |
||
566 | * @param scalar $index |
||
567 | * @return boolean |
||
568 | */ |
||
569 | public function issetLogo($index) |
||
573 | |||
574 | /** |
||
575 | * unset logo |
||
576 | * |
||
577 | * @param scalar $index |
||
578 | * @return void |
||
579 | */ |
||
580 | public function unsetLogo($index) |
||
584 | |||
585 | /** |
||
586 | * Gets as logo |
||
587 | * |
||
588 | * @return \AlgoWeb\ODataMetadata\Atom\Logo[] |
||
589 | */ |
||
590 | public function getLogo() |
||
594 | |||
595 | /** |
||
596 | * Sets a new logo |
||
597 | * |
||
598 | * @param \AlgoWeb\ODataMetadata\Atom\Logo[] $logo |
||
599 | * @return self |
||
600 | */ |
||
601 | public function setLogo(array $logo) |
||
606 | |||
607 | /** |
||
608 | * Adds as rights |
||
609 | * |
||
610 | * @return self |
||
611 | * @param \AlgoWeb\ODataMetadata\Atom\Rights $rights |
||
612 | */ |
||
613 | public function addToRights(\AlgoWeb\ODataMetadata\Atom\Rights $rights) |
||
618 | |||
619 | /** |
||
620 | * isset rights |
||
621 | * |
||
622 | * @param scalar $index |
||
623 | * @return boolean |
||
624 | */ |
||
625 | public function issetRights($index) |
||
629 | |||
630 | /** |
||
631 | * unset rights |
||
632 | * |
||
633 | * @param scalar $index |
||
634 | * @return void |
||
635 | */ |
||
636 | public function unsetRights($index) |
||
640 | |||
641 | /** |
||
642 | * Gets as rights |
||
643 | * |
||
644 | * @return \AlgoWeb\ODataMetadata\Atom\Rights[] |
||
645 | */ |
||
646 | public function getRights() |
||
650 | |||
651 | /** |
||
652 | * Sets a new rights |
||
653 | * |
||
654 | * @param \AlgoWeb\ODataMetadata\Atom\Rights[] $rights |
||
655 | * @return self |
||
656 | */ |
||
657 | public function setRights(array $rights) |
||
662 | |||
663 | /** |
||
664 | * Adds as subtitle |
||
665 | * |
||
666 | * @return self |
||
667 | * @param \AlgoWeb\ODataMetadata\Atom\Subtitle $subtitle |
||
668 | */ |
||
669 | public function addToSubtitle(\AlgoWeb\ODataMetadata\Atom\Subtitle $subtitle) |
||
674 | |||
675 | /** |
||
676 | * isset subtitle |
||
677 | * |
||
678 | * @param scalar $index |
||
679 | * @return boolean |
||
680 | */ |
||
681 | public function issetSubtitle($index) |
||
685 | |||
686 | /** |
||
687 | * unset subtitle |
||
688 | * |
||
689 | * @param scalar $index |
||
690 | * @return void |
||
691 | */ |
||
692 | public function unsetSubtitle($index) |
||
696 | |||
697 | /** |
||
698 | * Gets as subtitle |
||
699 | * |
||
700 | * @return \AlgoWeb\ODataMetadata\Atom\Subtitle[] |
||
701 | */ |
||
702 | public function getSubtitle() |
||
706 | |||
707 | /** |
||
708 | * Sets a new subtitle |
||
709 | * |
||
710 | * @param \AlgoWeb\ODataMetadata\Atom\Subtitle[] $subtitle |
||
711 | * @return self |
||
712 | */ |
||
713 | public function setSubtitle(array $subtitle) |
||
718 | |||
719 | /** |
||
720 | * Adds as title |
||
721 | * |
||
722 | * @return self |
||
723 | * @param \AlgoWeb\ODataMetadata\Atom\Title $title |
||
724 | */ |
||
725 | public function addToTitle(\AlgoWeb\ODataMetadata\Atom\Title $title) |
||
730 | |||
731 | /** |
||
732 | * isset title |
||
733 | * |
||
734 | * @param scalar $index |
||
735 | * @return boolean |
||
736 | */ |
||
737 | public function issetTitle($index) |
||
741 | |||
742 | /** |
||
743 | * unset title |
||
744 | * |
||
745 | * @param scalar $index |
||
746 | * @return void |
||
747 | */ |
||
748 | public function unsetTitle($index) |
||
752 | |||
753 | /** |
||
754 | * Gets as title |
||
755 | * |
||
756 | * @return \AlgoWeb\ODataMetadata\Atom\Title[] |
||
757 | */ |
||
758 | public function getTitle() |
||
762 | |||
763 | /** |
||
764 | * Sets a new title |
||
765 | * |
||
766 | * @param \AlgoWeb\ODataMetadata\Atom\Title[] $title |
||
767 | * @return self |
||
768 | */ |
||
769 | public function setTitle(array $title) |
||
774 | |||
775 | /** |
||
776 | * Adds as updated |
||
777 | * |
||
778 | * @return self |
||
779 | * @param \AlgoWeb\ODataMetadata\Atom\Updated $updated |
||
780 | */ |
||
781 | public function addToUpdated(\AlgoWeb\ODataMetadata\Atom\Updated $updated) |
||
786 | |||
787 | /** |
||
788 | * isset updated |
||
789 | * |
||
790 | * @param scalar $index |
||
791 | * @return boolean |
||
792 | */ |
||
793 | public function issetUpdated($index) |
||
797 | |||
798 | /** |
||
799 | * unset updated |
||
800 | * |
||
801 | * @param scalar $index |
||
802 | * @return void |
||
803 | */ |
||
804 | public function unsetUpdated($index) |
||
808 | |||
809 | /** |
||
810 | * Gets as updated |
||
811 | * |
||
812 | * @return \AlgoWeb\ODataMetadata\Atom\Updated[] |
||
813 | */ |
||
814 | public function getUpdated() |
||
818 | |||
819 | /** |
||
820 | * Sets a new updated |
||
821 | * |
||
822 | * @param \AlgoWeb\ODataMetadata\Atom\Updated[] $updated |
||
823 | * @return self |
||
824 | */ |
||
825 | public function setUpdated(array $updated) |
||
830 | |||
831 | /** |
||
832 | * Adds as entry |
||
833 | * |
||
834 | * @return self |
||
835 | * @param \AlgoWeb\ODataMetadata\Atom\Entry $entry |
||
836 | */ |
||
837 | public function addToEntry(\AlgoWeb\ODataMetadata\Atom\Entry $entry) |
||
842 | |||
843 | /** |
||
844 | * isset entry |
||
845 | * |
||
846 | * @param scalar $index |
||
847 | * @return boolean |
||
848 | */ |
||
849 | public function issetEntry($index) |
||
853 | |||
854 | /** |
||
855 | * unset entry |
||
856 | * |
||
857 | * @param scalar $index |
||
858 | * @return void |
||
859 | */ |
||
860 | public function unsetEntry($index) |
||
864 | |||
865 | /** |
||
866 | * Gets as entry |
||
867 | * |
||
868 | * @return \AlgoWeb\ODataMetadata\Atom\Entry[] |
||
869 | */ |
||
870 | public function getEntry() |
||
874 | |||
875 | /** |
||
876 | * Sets a new entry |
||
877 | * |
||
878 | * @param \AlgoWeb\ODataMetadata\Atom\Entry[] $entry |
||
879 | * @return self |
||
880 | */ |
||
881 | public function setEntry(array $entry) |
||
886 | } |
||
887 |