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 |
||
152 | protected function fix_calendar_text() |
||
153 | { |
||
154 | global $txt; |
||
155 | |||
156 | $txt['days'] = array( |
||
157 | $txt['sunday'], |
||
158 | $txt['monday'], |
||
159 | $txt['tuesday'], |
||
160 | $txt['wednesday'], |
||
161 | $txt['thursday'], |
||
162 | $txt['friday'], |
||
163 | $txt['saturday'], |
||
164 | ); |
||
165 | $txt['days_short'] = array( |
||
166 | $txt['sunday_short'], |
||
167 | $txt['monday_short'], |
||
168 | $txt['tuesday_short'], |
||
169 | $txt['wednesday_short'], |
||
170 | $txt['thursday_short'], |
||
171 | $txt['friday_short'], |
||
172 | $txt['saturday_short'], |
||
173 | ); |
||
174 | $txt['months'] = array( |
||
175 | 1 => $txt['january'], |
||
176 | $txt['february'], |
||
177 | $txt['march'], |
||
178 | $txt['april'], |
||
179 | $txt['may'], |
||
180 | $txt['june'], |
||
181 | $txt['july'], |
||
182 | $txt['august'], |
||
183 | $txt['september'], |
||
184 | $txt['october'], |
||
185 | $txt['november'], |
||
186 | $txt['december'], |
||
187 | ); |
||
188 | $txt['months_titles'] = array( |
||
189 | 1 => $txt['january_titles'], |
||
190 | $txt['february_titles'], |
||
191 | $txt['march_titles'], |
||
192 | $txt['april_titles'], |
||
193 | $txt['may_titles'], |
||
194 | $txt['june_titles'], |
||
195 | $txt['july_titles'], |
||
196 | $txt['august_titles'], |
||
197 | $txt['september_titles'], |
||
198 | $txt['october_titles'], |
||
199 | $txt['november_titles'], |
||
200 | $txt['december_titles'], |
||
201 | ); |
||
202 | $txt['months_short'] = array( |
||
203 | 1 => $txt['january_short'], |
||
204 | $txt['february_short'], |
||
205 | $txt['march_short'], |
||
206 | $txt['april_short'], |
||
207 | $txt['may_short'], |
||
208 | $txt['june_short'], |
||
209 | $txt['july_short'], |
||
210 | $txt['august_short'], |
||
211 | $txt['september_short'], |
||
212 | $txt['october_short'], |
||
213 | $txt['november_short'], |
||
214 | $txt['december_short'], |
||
215 | ); |
||
217 | } |