| 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 |
||
| 20 | function jetpack_business_hours_get_default_days() { |
||
| 21 | return array( |
||
| 22 | array( |
||
| 23 | 'name' => 'Sun', |
||
| 24 | 'hours' => array(), |
||
| 25 | ), |
||
| 26 | array( |
||
| 27 | 'name' => 'Mon', |
||
| 28 | 'hours' => array( |
||
| 29 | array( |
||
| 30 | 'opening' => '09:00', |
||
| 31 | 'closing' => '17:00', |
||
| 32 | ), |
||
| 33 | ), |
||
| 34 | ), |
||
| 35 | array( |
||
| 36 | 'name' => 'Tue', |
||
| 37 | 'hours' => array( |
||
| 38 | array( |
||
| 39 | 'opening' => '09:00', |
||
| 40 | 'closing' => '17:00', |
||
| 41 | ), |
||
| 42 | ), |
||
| 43 | ), |
||
| 44 | array( |
||
| 45 | 'name' => 'Wed', |
||
| 46 | 'hours' => array( |
||
| 47 | array( |
||
| 48 | 'opening' => '09:00', |
||
| 49 | 'closing' => '17:00', |
||
| 50 | ), |
||
| 51 | ), |
||
| 52 | ), |
||
| 53 | array( |
||
| 54 | 'name' => 'Thu', |
||
| 55 | 'hours' => array( |
||
| 56 | array( |
||
| 57 | 'opening' => '09:00', |
||
| 58 | 'closing' => '17:00', |
||
| 59 | ), |
||
| 60 | ), |
||
| 61 | ), |
||
| 62 | array( |
||
| 63 | 'name' => 'Fri', |
||
| 64 | 'hours' => array( |
||
| 65 | array( |
||
| 66 | 'opening' => '09:00', |
||
| 67 | 'closing' => '17:00', |
||
| 68 | ), |
||
| 69 | ), |
||
| 70 | ), |
||
| 71 | array( |
||
| 72 | 'name' => 'Sat', |
||
| 73 | 'hours' => array(), |
||
| 74 | ), |
||
| 75 | ); |
||
| 76 | } |
||
| 77 | |||
| 148 |