| Conditions | 1 |
| Paths | 1 |
| Total Lines | 63 |
| Code Lines | 41 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 1 | Features | 2 |
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 |
||
| 68 | public function actionData() |
||
| 69 | { |
||
| 70 | return [ |
||
| 71 | 'app' => [ |
||
| 72 | 'name' => Yii::$app->name, |
||
| 73 | 'description' => params('seoDescription'), |
||
| 74 | 'keywords' => params('seoKeywords'), |
||
| 75 | 'google_analytics' => params('googleAnalyticsAU'), |
||
| 76 | 'telegram_bot_name' => params('telegramBotName') |
||
| 77 | ], |
||
| 78 | 'menu' => [ |
||
| 79 | [ |
||
| 80 | 'text' => 'Main', |
||
| 81 | 'group' => false, |
||
| 82 | 'children' => [ |
||
| 83 | [ |
||
| 84 | 'text' => '仪表盘', |
||
| 85 | 'link' => '/dashboard', |
||
| 86 | 'icon' => 'anticon-dashboard', |
||
| 87 | ], |
||
| 88 | [ |
||
| 89 | 'text' => '账户', |
||
| 90 | 'link' => '/account/index', |
||
| 91 | 'icon' => 'anticon-account-book', |
||
| 92 | ], |
||
| 93 | [ |
||
| 94 | 'text' => '记录', |
||
| 95 | 'link' => '/record/index', |
||
| 96 | 'icon' => 'anticon-database', |
||
| 97 | ], |
||
| 98 | [ |
||
| 99 | 'text' => '定时', |
||
| 100 | 'link' => '/recurrence/index', |
||
| 101 | 'icon' => 'anticon-field-time', |
||
| 102 | ], |
||
| 103 | [ |
||
| 104 | 'text' => '分析', |
||
| 105 | 'link' => '/analysis/index', |
||
| 106 | 'icon' => 'anticon-area-chart', |
||
| 107 | ], |
||
| 108 | [ |
||
| 109 | 'text' => '设置', |
||
| 110 | 'icon' => 'anticon-setting', |
||
| 111 | 'children' => [ |
||
| 112 | [ |
||
| 113 | 'text' => '个人设置', |
||
| 114 | 'link' => '/settings/personal', |
||
| 115 | 'icon' => 'anticon-user', |
||
| 116 | ], |
||
| 117 | [ |
||
| 118 | 'text' => '分类设置', |
||
| 119 | 'link' => '/settings/categories', |
||
| 120 | 'icon' => 'anticon-appstore', |
||
| 121 | ], |
||
| 122 | [ |
||
| 123 | 'text' => '标签设置', |
||
| 124 | 'link' => '/settings/tags', |
||
| 125 | 'icon' => 'anticon-appstore', |
||
| 126 | ], |
||
| 127 | [ |
||
| 128 | 'text' => '规则设置', |
||
| 129 | 'link' => '/settings/rules', |
||
| 130 | 'icon' => 'anticon-group', |
||
| 131 | ] |
||
| 140 |