| Conditions | 1 |
| Paths | 1 |
| Total Lines | 57 |
| 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 |
||
| 35 | function get_default_days() { |
||
| 36 | return array( |
||
| 37 | array( |
||
| 38 | 'name' => 'Sun', |
||
| 39 | 'hours' => array(), |
||
| 40 | ), |
||
| 41 | array( |
||
| 42 | 'name' => 'Mon', |
||
| 43 | 'hours' => array( |
||
| 44 | array( |
||
| 45 | 'opening' => '09:00', |
||
| 46 | 'closing' => '17:00', |
||
| 47 | ), |
||
| 48 | ), |
||
| 49 | ), |
||
| 50 | array( |
||
| 51 | 'name' => 'Tue', |
||
| 52 | 'hours' => array( |
||
| 53 | array( |
||
| 54 | 'opening' => '09:00', |
||
| 55 | 'closing' => '17:00', |
||
| 56 | ), |
||
| 57 | ), |
||
| 58 | ), |
||
| 59 | array( |
||
| 60 | 'name' => 'Wed', |
||
| 61 | 'hours' => array( |
||
| 62 | array( |
||
| 63 | 'opening' => '09:00', |
||
| 64 | 'closing' => '17:00', |
||
| 65 | ), |
||
| 66 | ), |
||
| 67 | ), |
||
| 68 | array( |
||
| 69 | 'name' => 'Thu', |
||
| 70 | 'hours' => array( |
||
| 71 | array( |
||
| 72 | 'opening' => '09:00', |
||
| 73 | 'closing' => '17:00', |
||
| 74 | ), |
||
| 75 | ), |
||
| 76 | ), |
||
| 77 | array( |
||
| 78 | 'name' => 'Fri', |
||
| 79 | 'hours' => array( |
||
| 80 | array( |
||
| 81 | 'opening' => '09:00', |
||
| 82 | 'closing' => '17:00', |
||
| 83 | ), |
||
| 84 | ), |
||
| 85 | ), |
||
| 86 | array( |
||
| 87 | 'name' => 'Sat', |
||
| 88 | 'hours' => array(), |
||
| 89 | ), |
||
| 90 | ); |
||
| 91 | } |
||
| 92 | |||
| 166 |