Complex classes like DeprecatedFunctionsSniffTest 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 DeprecatedFunctionsSniffTest, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
16 | class DeprecatedFunctionsSniffTest extends BaseSniffTest |
||
17 | { |
||
18 | /** |
||
19 | * Test call user method |
||
20 | * |
||
21 | * @return void |
||
22 | */ |
||
23 | public function testCallUserMethod() |
||
31 | |||
32 | /** |
||
33 | * Test call user method array |
||
34 | * |
||
35 | * @return void |
||
36 | */ |
||
37 | public function testCallUserMethodArray() |
||
45 | |||
46 | /** |
||
47 | * Test define syslog variables |
||
48 | * |
||
49 | * @return void |
||
50 | */ |
||
51 | public function testDefineSyslogVariables() |
||
56 | |||
57 | /** |
||
58 | * Test dl |
||
59 | * |
||
60 | * @return void |
||
61 | */ |
||
62 | public function testDl() |
||
68 | |||
69 | /** |
||
70 | * Test ereg |
||
71 | * |
||
72 | * @return void |
||
73 | */ |
||
74 | public function testEreg() |
||
80 | |||
81 | /** |
||
82 | * Test ereg_replace |
||
83 | * |
||
84 | * @return void |
||
85 | */ |
||
86 | public function testEregReplace() |
||
92 | |||
93 | /** |
||
94 | * Test eregi |
||
95 | * |
||
96 | * @return void |
||
97 | */ |
||
98 | public function testEregi() |
||
104 | |||
105 | /** |
||
106 | * Test eregi_replace |
||
107 | * |
||
108 | * @return void |
||
109 | */ |
||
110 | public function testEregiReplace() |
||
116 | |||
117 | /** |
||
118 | * Test import_request_variables |
||
119 | * |
||
120 | * @return void |
||
121 | */ |
||
122 | public function testImportRequestVariables() |
||
128 | |||
129 | /** |
||
130 | * Test mcrypt_generic_end |
||
131 | * |
||
132 | * @return void |
||
133 | */ |
||
134 | public function testMcryptGenericEnd() |
||
142 | |||
143 | /** |
||
144 | * Test mysql_db_query |
||
145 | * |
||
146 | * @return void |
||
147 | */ |
||
148 | public function testMysqlDbQuery() |
||
154 | |||
155 | /** |
||
156 | * Test mysql_escape_string |
||
157 | * |
||
158 | * @return void |
||
159 | */ |
||
160 | public function testMysqlEscapeString() |
||
166 | |||
167 | /** |
||
168 | * Test mysql_list_dbs |
||
169 | * |
||
170 | * @return void |
||
171 | */ |
||
172 | public function testMysqlListDbs() |
||
178 | |||
179 | /** |
||
180 | * Test mysqli_bind_param |
||
181 | * |
||
182 | * @return void |
||
183 | */ |
||
184 | public function testMysqliBindParam() |
||
190 | |||
191 | /** |
||
192 | * Test mysqli_bind_result |
||
193 | * |
||
194 | * @return void |
||
195 | */ |
||
196 | public function testMysqliBindResult() |
||
202 | |||
203 | /** |
||
204 | * Test mysqli_client_encoding |
||
205 | * |
||
206 | * @return void |
||
207 | */ |
||
208 | public function testMysqliClientEncoding() |
||
214 | |||
215 | /** |
||
216 | * Test mysqli_fetch |
||
217 | * |
||
218 | * @return void |
||
219 | */ |
||
220 | public function testMysqliFetch() |
||
226 | |||
227 | /** |
||
228 | * Test mysqli_param_count |
||
229 | * |
||
230 | * @return void |
||
231 | */ |
||
232 | public function testMysqliParamCount() |
||
238 | |||
239 | /** |
||
240 | * Test mysqli_get_metadata |
||
241 | * |
||
242 | * @return void |
||
243 | */ |
||
244 | public function testMysqliGetMetadata() |
||
250 | |||
251 | /** |
||
252 | * Test mysqli_send_long_data |
||
253 | * |
||
254 | * @return void |
||
255 | */ |
||
256 | public function testMysqliSendLongData() |
||
262 | |||
263 | /** |
||
264 | * Test magic_quotes_runtime |
||
265 | * |
||
266 | * @return void |
||
267 | */ |
||
268 | public function testMagicQuotesRuntime() |
||
276 | |||
277 | /** |
||
278 | * Test session_register |
||
279 | * |
||
280 | * @return void |
||
281 | */ |
||
282 | public function testSessionRegister() |
||
288 | |||
289 | /** |
||
290 | * Test session_unregister |
||
291 | * |
||
292 | * @return void |
||
293 | */ |
||
294 | public function testSessionUnregister() |
||
300 | |||
301 | /** |
||
302 | * Test session_is_registered |
||
303 | * |
||
304 | * @return void |
||
305 | */ |
||
306 | public function testSessionIsRegistered() |
||
312 | |||
313 | /** |
||
314 | * Test set_magic_quotes_runtime |
||
315 | * |
||
316 | * @return void |
||
317 | */ |
||
318 | public function testSetMagicQuotesRuntime() |
||
326 | |||
327 | /** |
||
328 | * Test set_socket_blocking |
||
329 | * |
||
330 | * @return void |
||
331 | */ |
||
332 | public function testSetSocketBlocking() |
||
340 | |||
341 | /** |
||
342 | * Test split |
||
343 | * |
||
344 | * @return void |
||
345 | */ |
||
346 | public function testSplit() |
||
352 | |||
353 | /** |
||
354 | * Test spliti |
||
355 | * |
||
356 | * @return void |
||
357 | */ |
||
358 | public function testSpliti() |
||
364 | |||
365 | /** |
||
366 | * Test sql_regcase |
||
367 | * |
||
368 | * @return void |
||
369 | */ |
||
370 | public function testSqlRegcase() |
||
376 | |||
377 | /** |
||
378 | * Test php_logo_guid |
||
379 | * |
||
380 | * @return void |
||
381 | */ |
||
382 | public function testPhpLogoGuid() |
||
388 | |||
389 | /** |
||
390 | * Test php_egg_logo_guid |
||
391 | * |
||
392 | * @return void |
||
393 | */ |
||
394 | public function testPhpEggLogoGuid() |
||
400 | |||
401 | /** |
||
402 | * Test php_real_logo_guid |
||
403 | * |
||
404 | * @return void |
||
405 | */ |
||
406 | public function testPhpRealLogoGuid() |
||
412 | |||
413 | /** |
||
414 | * Test zend_logo_guid |
||
415 | * |
||
416 | * @return void |
||
417 | */ |
||
418 | public function testZendLogoGuid() |
||
424 | |||
425 | /** |
||
426 | * Test datefmt_set_timezone_id |
||
427 | * |
||
428 | * @return void |
||
429 | */ |
||
430 | public function testDateFmtSetTimezone() |
||
438 | |||
439 | /** |
||
440 | * Test mcrypt_ecb |
||
441 | * |
||
442 | * @return void |
||
443 | */ |
||
444 | public function testMcryptEcb() |
||
452 | |||
453 | /** |
||
454 | * Test mcrypt_cbc |
||
455 | * |
||
456 | * @return void |
||
457 | */ |
||
458 | public function testMcryptCbc() |
||
466 | |||
467 | /** |
||
468 | * Test mcrypt_cfb |
||
469 | * |
||
470 | * @return void |
||
471 | */ |
||
472 | public function testMcryptCfb() |
||
480 | |||
481 | /** |
||
482 | * Test mcrypt_ofb |
||
483 | * |
||
484 | * @return void |
||
485 | */ |
||
486 | public function testMcryptOfb() |
||
494 | |||
495 | /** |
||
496 | * Test ocibindbyname |
||
497 | * |
||
498 | * @return void |
||
499 | */ |
||
500 | public function testOcibindbyname() |
||
506 | |||
507 | /** |
||
508 | * Test ocicancel |
||
509 | * |
||
510 | * @return void |
||
511 | */ |
||
512 | public function testOcicancel() |
||
518 | |||
519 | /** |
||
520 | * Test ocicloselob |
||
521 | * |
||
522 | * @return void |
||
523 | */ |
||
524 | public function testOcicloselob() |
||
530 | |||
531 | /** |
||
532 | * Test ocicollappend |
||
533 | * |
||
534 | * @return void |
||
535 | */ |
||
536 | public function testOcicollappend() |
||
542 | |||
543 | /** |
||
544 | * Test ocicollassign |
||
545 | * |
||
546 | * @return void |
||
547 | */ |
||
548 | public function testOcicollassign() |
||
554 | |||
555 | /** |
||
556 | * Test ocicollassignelem |
||
557 | * |
||
558 | * @return void |
||
559 | */ |
||
560 | public function testOcicollassignelem() |
||
566 | |||
567 | /** |
||
568 | * Test ocicollgetelem |
||
569 | * |
||
570 | * @return void |
||
571 | */ |
||
572 | public function testOcicollgetelem() |
||
578 | |||
579 | /** |
||
580 | * Test ocicollmax |
||
581 | * |
||
582 | * @return void |
||
583 | */ |
||
584 | public function testOcicollmax() |
||
590 | |||
591 | /** |
||
592 | * Test ocicollsize |
||
593 | * |
||
594 | * @return void |
||
595 | */ |
||
596 | public function testOcicollsize() |
||
602 | |||
603 | /** |
||
604 | * Test ocicolltrim |
||
605 | * |
||
606 | * @return void |
||
607 | */ |
||
608 | public function testOcicolltrim() |
||
614 | |||
615 | /** |
||
616 | * Test ocicolumnisnull |
||
617 | * |
||
618 | * @return void |
||
619 | */ |
||
620 | public function testOcicolumnisnull() |
||
626 | |||
627 | /** |
||
628 | * Test ocicolumnname |
||
629 | * |
||
630 | * @return void |
||
631 | */ |
||
632 | public function testOcicolumnname() |
||
638 | |||
639 | /** |
||
640 | * Test ocicolumnprecision |
||
641 | * |
||
642 | * @return void |
||
643 | */ |
||
644 | public function testOcicolumnprecision() |
||
650 | |||
651 | /** |
||
652 | * Test ocicolumnscale |
||
653 | * |
||
654 | * @return void |
||
655 | */ |
||
656 | public function testOcicolumnscale() |
||
662 | |||
663 | /** |
||
664 | * Test ocicolumnsize |
||
665 | * |
||
666 | * @return void |
||
667 | */ |
||
668 | public function testOcicolumnsize() |
||
674 | |||
675 | /** |
||
676 | * Test ocicolumntype |
||
677 | * |
||
678 | * @return void |
||
679 | */ |
||
680 | public function testOcicolumntype() |
||
686 | |||
687 | /** |
||
688 | * Test ocicolumntyperaw |
||
689 | * |
||
690 | * @return void |
||
691 | */ |
||
692 | public function testOcicolumntyperaw() |
||
698 | |||
699 | /** |
||
700 | * Test ocicommit |
||
701 | * |
||
702 | * @return void |
||
703 | */ |
||
704 | public function testOcicommit() |
||
710 | |||
711 | /** |
||
712 | * Test ocidefinebyname |
||
713 | * |
||
714 | * @return void |
||
715 | */ |
||
716 | public function testOcidefinebyname() |
||
722 | |||
723 | /** |
||
724 | * Test ocierror |
||
725 | * |
||
726 | * @return void |
||
727 | */ |
||
728 | public function testOcierror() |
||
734 | |||
735 | /** |
||
736 | * Test ociexecute |
||
737 | * |
||
738 | * @return void |
||
739 | */ |
||
740 | public function testOciexecute() |
||
746 | |||
747 | /** |
||
748 | * Test ocifetch |
||
749 | * |
||
750 | * @return void |
||
751 | */ |
||
752 | public function testOcifetch() |
||
758 | |||
759 | /** |
||
760 | * Test ocifetchinto |
||
761 | * |
||
762 | * @return void |
||
763 | */ |
||
764 | public function testOcifetchinto() |
||
770 | |||
771 | /** |
||
772 | * Test ocifetchstatement |
||
773 | * |
||
774 | * @return void |
||
775 | */ |
||
776 | public function testOcifetchstatement() |
||
782 | |||
783 | /** |
||
784 | * Test ocifreecollection |
||
785 | * |
||
786 | * @return void |
||
787 | */ |
||
788 | public function testOcifreecollection() |
||
794 | |||
795 | /** |
||
796 | * Test ocifreecursor |
||
797 | * |
||
798 | * @return void |
||
799 | */ |
||
800 | public function testOcifreecursor() |
||
806 | |||
807 | /** |
||
808 | * Test ocifreedesc |
||
809 | * |
||
810 | * @return void |
||
811 | */ |
||
812 | public function testOcifreedesc() |
||
818 | |||
819 | /** |
||
820 | * Test ocifreestatement |
||
821 | * |
||
822 | * @return void |
||
823 | */ |
||
824 | public function testOcifreestatement() |
||
830 | |||
831 | /** |
||
832 | * Test ociinternaldebug |
||
833 | * |
||
834 | * @return void |
||
835 | */ |
||
836 | public function testOciinternaldebug() |
||
842 | |||
843 | /** |
||
844 | * Test ociloadlob |
||
845 | * |
||
846 | * @return void |
||
847 | */ |
||
848 | public function testOciloadlob() |
||
854 | |||
855 | /** |
||
856 | * Test ocilogoff |
||
857 | * |
||
858 | * @return void |
||
859 | */ |
||
860 | public function testOcilogoff() |
||
866 | |||
867 | /** |
||
868 | * Test ocilogon |
||
869 | * |
||
870 | * @return void |
||
871 | */ |
||
872 | public function testOcilogon() |
||
878 | |||
879 | /** |
||
880 | * Test ocinewcollection |
||
881 | * |
||
882 | * @return void |
||
883 | */ |
||
884 | public function testOcinewcollection() |
||
890 | |||
891 | /** |
||
892 | * Test ocinewcursor |
||
893 | * |
||
894 | * @return void |
||
895 | */ |
||
896 | public function testOcinewcursor() |
||
902 | |||
903 | /** |
||
904 | * Test ocinewdescriptor |
||
905 | * |
||
906 | * @return void |
||
907 | */ |
||
908 | public function testOcinewdescriptor() |
||
914 | |||
915 | /** |
||
916 | * Test ocinlogon |
||
917 | * |
||
918 | * @return void |
||
919 | */ |
||
920 | public function testOcinlogon() |
||
926 | |||
927 | /** |
||
928 | * Test ocinumcols |
||
929 | * |
||
930 | * @return void |
||
931 | */ |
||
932 | public function testOcinumcols() |
||
938 | |||
939 | /** |
||
940 | * Test ociparse |
||
941 | * |
||
942 | * @return void |
||
943 | */ |
||
944 | public function testOciparse() |
||
950 | |||
951 | /** |
||
952 | * Test ociplogon |
||
953 | * |
||
954 | * @return void |
||
955 | */ |
||
956 | public function testOciplogon() |
||
962 | |||
963 | /** |
||
964 | * Test ociresult |
||
965 | * |
||
966 | * @return void |
||
967 | */ |
||
968 | public function testOciresult() |
||
974 | |||
975 | /** |
||
976 | * Test ocirollback |
||
977 | * |
||
978 | * @return void |
||
979 | */ |
||
980 | public function testOcirollback() |
||
986 | |||
987 | /** |
||
988 | * Test ocirowcount |
||
989 | * |
||
990 | * @return void |
||
991 | */ |
||
992 | public function testOcirowcount() |
||
998 | |||
999 | /** |
||
1000 | * Test ocisavelob |
||
1001 | * |
||
1002 | * @return void |
||
1003 | */ |
||
1004 | public function testOcisavelob() |
||
1010 | |||
1011 | /** |
||
1012 | * Test ocisavelobfile |
||
1013 | * |
||
1014 | * @return void |
||
1015 | */ |
||
1016 | public function testOcisavelobfile() |
||
1022 | |||
1023 | /** |
||
1024 | * Test ociserverversion |
||
1025 | * |
||
1026 | * @return void |
||
1027 | */ |
||
1028 | public function testOciserverversion() |
||
1034 | |||
1035 | /** |
||
1036 | * Test ocisetprefetch |
||
1037 | * |
||
1038 | * @return void |
||
1039 | */ |
||
1040 | public function testOcisetprefetch() |
||
1046 | |||
1047 | /** |
||
1048 | * Test ocistatementtype |
||
1049 | * |
||
1050 | * @return void |
||
1051 | */ |
||
1052 | public function testOcistatementtype() |
||
1058 | |||
1059 | /** |
||
1060 | * Test ociwritelobtofile |
||
1061 | * |
||
1062 | * @return void |
||
1063 | */ |
||
1064 | public function testOciwritelobtofile() |
||
1070 | |||
1071 | /** |
||
1072 | * Test ociwritetemporarylob |
||
1073 | * |
||
1074 | * @return void |
||
1075 | */ |
||
1076 | public function testOciwritetemporarylob() |
||
1082 | |||
1083 | /** |
||
1084 | * GD Type 1 PostScript functions |
||
1085 | * |
||
1086 | * @return void |
||
1087 | */ |
||
1088 | public function testGDType1() |
||
1108 | |||
1109 | /** |
||
1110 | * Test when setting the testVersion |
||
1111 | * |
||
1112 | * @return void |
||
1113 | */ |
||
1114 | public function testSettingTestVersion() |
||
1120 | } |
||
1121 | |||
1122 |