Conditions | 1 |
Paths | 1 |
Total Lines | 63 |
Code Lines | 56 |
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 |
||
177 | protected function fix_calendar_text() |
||
178 | { |
||
179 | global $txt; |
||
180 | |||
181 | $txt['days'] = array( |
||
182 | $txt['sunday'], |
||
183 | $txt['monday'], |
||
184 | $txt['tuesday'], |
||
185 | $txt['wednesday'], |
||
186 | $txt['thursday'], |
||
187 | $txt['friday'], |
||
188 | $txt['saturday'], |
||
189 | ); |
||
190 | $txt['days_short'] = array( |
||
191 | $txt['sunday_short'], |
||
192 | $txt['monday_short'], |
||
193 | $txt['tuesday_short'], |
||
194 | $txt['wednesday_short'], |
||
195 | $txt['thursday_short'], |
||
196 | $txt['friday_short'], |
||
197 | $txt['saturday_short'], |
||
198 | ); |
||
199 | $txt['months'] = array( |
||
200 | 1 => $txt['january'], |
||
201 | $txt['february'], |
||
202 | $txt['march'], |
||
203 | $txt['april'], |
||
204 | $txt['may'], |
||
205 | $txt['june'], |
||
206 | $txt['july'], |
||
207 | $txt['august'], |
||
208 | $txt['september'], |
||
209 | $txt['october'], |
||
210 | $txt['november'], |
||
211 | $txt['december'], |
||
212 | ); |
||
213 | $txt['months_titles'] = array( |
||
214 | 1 => $txt['january_titles'], |
||
215 | $txt['february_titles'], |
||
216 | $txt['march_titles'], |
||
217 | $txt['april_titles'], |
||
218 | $txt['may_titles'], |
||
219 | $txt['june_titles'], |
||
220 | $txt['july_titles'], |
||
221 | $txt['august_titles'], |
||
222 | $txt['september_titles'], |
||
223 | $txt['october_titles'], |
||
224 | $txt['november_titles'], |
||
225 | $txt['december_titles'], |
||
226 | ); |
||
227 | $txt['months_short'] = array( |
||
228 | 1 => $txt['january_short'], |
||
229 | $txt['february_short'], |
||
230 | $txt['march_short'], |
||
231 | $txt['april_short'], |
||
232 | $txt['may_short'], |
||
233 | $txt['june_short'], |
||
234 | $txt['july_short'], |
||
235 | $txt['august_short'], |
||
236 | $txt['september_short'], |
||
237 | $txt['october_short'], |
||
238 | $txt['november_short'], |
||
239 | $txt['december_short'], |
||
240 | ); |
||
242 | } |