Conditions | 13 |
Paths | 13 |
Total Lines | 75 |
Code Lines | 37 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 |
||
104 | function getBulan1($bln1) |
||
105 | { |
||
106 | switch ($bln1) { |
||
107 | |||
108 | case 1: |
||
109 | |||
110 | return 'January'; |
||
111 | |||
112 | break; |
||
113 | |||
114 | case 2: |
||
115 | |||
116 | return 'February'; |
||
117 | |||
118 | break; |
||
119 | |||
120 | case 3: |
||
121 | |||
122 | return 'March'; |
||
123 | |||
124 | break; |
||
125 | |||
126 | case 4: |
||
127 | |||
128 | return 'April'; |
||
129 | |||
130 | break; |
||
131 | |||
132 | case 5: |
||
133 | |||
134 | return 'May'; |
||
135 | |||
136 | break; |
||
137 | |||
138 | case 6: |
||
139 | |||
140 | return 'June'; |
||
141 | |||
142 | break; |
||
143 | |||
144 | case 7: |
||
145 | |||
146 | return 'July'; |
||
147 | |||
148 | break; |
||
149 | |||
150 | case 8: |
||
151 | |||
152 | return 'August'; |
||
153 | |||
154 | break; |
||
155 | |||
156 | case 9: |
||
157 | |||
158 | return 'September'; |
||
159 | |||
160 | break; |
||
161 | |||
162 | case 10: |
||
163 | |||
164 | return 'October'; |
||
165 | |||
166 | break; |
||
167 | |||
168 | case 11: |
||
169 | |||
170 | return 'November'; |
||
171 | |||
172 | break; |
||
173 | |||
174 | case 12: |
||
175 | |||
176 | return 'December'; |
||
177 | |||
178 | break; |
||
179 | |||
185 |
The
break
statement is not necessary if it is preceded for example by areturn
statement:If you would like to keep this construct to be consistent with other
case
statements, you can safely mark this issue as a false-positive.