Conditions | 1 |
Paths | 1 |
Total Lines | 60 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
53 | public function shorthandsProvider() |
||
54 | { |
||
55 | return [ |
||
56 | [ |
||
57 | ['create', 'crore'], |
||
58 | [ |
||
59 | 'cre' => 'create', |
||
60 | 'crea' => 'create', |
||
61 | 'creat' => 'create', |
||
62 | 'create' => 'create', |
||
63 | 'cro' => 'crore', |
||
64 | 'cror' => 'crore', |
||
65 | 'crore' => 'crore', |
||
66 | ], |
||
67 | ], |
||
68 | [ |
||
69 | ['crore', 'create', 'crop'], |
||
70 | [ |
||
71 | 'cror' => 'crore', |
||
72 | 'crore' => 'crore', |
||
73 | 'cre' => 'create', |
||
74 | 'crea' => 'create', |
||
75 | 'creat' => 'create', |
||
76 | 'create' => 'create', |
||
77 | 'crop' => 'crop', |
||
78 | ], |
||
79 | ], |
||
80 | [ |
||
81 | ['create', 'crore', 'create', 'crore'], |
||
82 | [ |
||
83 | 'cre' => 'create', |
||
84 | 'crea' => 'create', |
||
85 | 'creat' => 'create', |
||
86 | 'create' => 'create', |
||
87 | 'cro' => 'crore', |
||
88 | 'cror' => 'crore', |
||
89 | 'crore' => 'crore', |
||
90 | ], |
||
91 | ], |
||
92 | [ |
||
93 | ['ruby', 'rules'], |
||
94 | [ |
||
95 | 'rub' => 'ruby', |
||
96 | 'ruby' => 'ruby', |
||
97 | 'rul' => 'rules', |
||
98 | 'rule' => 'rules', |
||
99 | 'rules' => 'rules', |
||
100 | ], |
||
101 | ], |
||
102 | [ |
||
103 | 'ruby', |
||
104 | [ |
||
105 | 'r' => 'ruby', |
||
106 | 'ru' => 'ruby', |
||
107 | 'rub' => 'ruby', |
||
108 | 'ruby' => 'ruby', |
||
109 | ], |
||
110 | ], |
||
111 | ]; |
||
112 | } |
||
113 | } |
||
114 |