| Conditions | 1 |
| Paths | 1 |
| Total Lines | 57 |
| Code Lines | 42 |
| 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 |
||
| 25 | public function elements() { |
||
| 26 | return [ |
||
| 27 | [ |
||
| 28 | 'name' => 'skin', |
||
| 29 | 'decorator' => [ |
||
| 30 | 'DropDown', |
||
| 31 | 'caption' => __('Clock skin'), |
||
| 32 | 'values' => [ |
||
| 33 | 'swissRail' => 'swissRail', |
||
| 34 | 'chunkySwiss' => 'chunkySwiss', |
||
| 35 | 'chunkySwissOnBlack' => 'chunkySwissOnBlack', |
||
| 36 | 'fancy' => 'fancy', |
||
| 37 | 'machine' => 'machine', |
||
| 38 | 'classic' => 'classic', |
||
| 39 | 'modern' => 'modern', |
||
| 40 | 'simple' => 'simple', |
||
| 41 | 'securephp' => 'securephp', |
||
| 42 | 'Tes2' => 'Tes2', |
||
| 43 | 'Lev' => 'Lev', |
||
| 44 | 'Sand' => 'Sand', |
||
| 45 | 'Sun' => 'Sun', |
||
| 46 | 'Tor' => 'Tor', |
||
| 47 | 'Babosa' => 'Babosa', |
||
| 48 | 'Tumb' => 'Tumb', |
||
| 49 | 'Stone' => 'Stone', |
||
| 50 | 'Disc' => 'Disc', |
||
| 51 | 'flash' => 'flash' |
||
| 52 | ] |
||
| 53 | ], |
||
| 54 | 'default' => 'swissRail', |
||
| 55 | 'rules' => [ |
||
| 56 | [ |
||
| 57 | 'type' => 'empty', |
||
| 58 | 'prompt' => __('Field required'), |
||
| 59 | ] |
||
| 60 | ], |
||
| 61 | |||
| 62 | ], |
||
| 63 | [ |
||
| 64 | 'name' => 'type', |
||
| 65 | 'decorator' => [ |
||
| 66 | 'DropDown', |
||
| 67 | 'caption' => __('Type'), |
||
| 68 | 'values' => [ |
||
| 69 | 'single' => __('Single Clock'), |
||
| 70 | 'double' => __('Double Clock') |
||
| 71 | ], |
||
| 72 | ], |
||
| 73 | 'default' => 'double', |
||
| 74 | ], |
||
| 75 | [ |
||
| 76 | 'name' => 'second_clock_label', |
||
| 77 | 'decorator' => [ |
||
| 78 | 'caption' => __('Second clock label'), |
||
| 79 | ], |
||
| 80 | 'default' => __('Singapore / China'), |
||
| 81 | 'display' => ['type' => 'isExactly[double]'] |
||
| 82 | ], |
||
| 85 | } |