| Conditions | 1 |
| Paths | 1 |
| Total Lines | 63 |
| Code Lines | 47 |
| 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 |
||
| 18 | public function items() |
||
| 19 | { |
||
| 20 | return [ |
||
| 21 | 'hosting' => [ |
||
| 22 | 'label' => Yii::t('hipanel/hosting', 'Hosting'), |
||
| 23 | 'url' => '#', |
||
| 24 | 'icon' => 'fa-sitemap', |
||
| 25 | 'items' => [ |
||
| 26 | 'accounts' => [ |
||
| 27 | 'label' => Yii::t('hipanel/hosting', 'Accounts'), |
||
| 28 | 'url' => ['/hosting/account/index'], |
||
| 29 | 'icon' => 'fa-user', |
||
| 30 | ], |
||
| 31 | 'dbs' => [ |
||
| 32 | 'label' => Yii::t('hipanel/hosting', 'Databases'), |
||
| 33 | 'url' => ['/hosting/db/index'], |
||
| 34 | 'icon' => 'fa-database', |
||
| 35 | ], |
||
| 36 | 'hdomains' => [ |
||
| 37 | 'label' => Yii::t('hipanel/hosting', 'Domains'), |
||
| 38 | 'url' => ['/hosting/hdomain/index'], |
||
| 39 | 'icon' => 'fa-globe', |
||
| 40 | 'visible' => function () { |
||
| 41 | return (bool)Yii::getAlias('@domain', false); |
||
| 42 | }, |
||
| 43 | ], |
||
| 44 | 'mails' => [ |
||
| 45 | 'label' => Yii::t('hipanel/hosting', 'Mailboxes'), |
||
| 46 | 'url' => ['/hosting/mail/index'], |
||
| 47 | 'icon' => 'fa-envelope-o', |
||
| 48 | 'visible' => function () { |
||
| 49 | return (bool)Yii::getAlias('@mail', false); |
||
| 50 | }, |
||
| 51 | ], |
||
| 52 | 'backuping' => [ |
||
| 53 | 'label' => Yii::t('hipanel/hosting', 'Backups'), |
||
| 54 | 'icon' => 'fa-archive', |
||
| 55 | 'url' => ['/hosting/backuping/index'], |
||
| 56 | ], |
||
| 57 | 'crontab' => [ |
||
| 58 | 'label' => Yii::t('hipanel/hosting', 'Crons'), |
||
| 59 | 'icon' => 'fa-clock-o', |
||
| 60 | 'url' => ['/hosting/crontab/index'], |
||
| 61 | ], |
||
| 62 | 'ip' => [ |
||
| 63 | 'label' => Yii::t('hipanel/hosting', 'IP addresses'), |
||
| 64 | 'icon' => 'fa-location-arrow', |
||
| 65 | 'url' => ['/hosting/ip/index'], |
||
| 66 | ], |
||
| 67 | 'service' => [ |
||
| 68 | 'label' => Yii::t('hipanel/hosting', 'Services'), |
||
| 69 | 'icon' => 'fa-terminal', |
||
| 70 | 'url' => ['/hosting/service/index'], |
||
| 71 | ], |
||
| 72 | 'request' => [ |
||
| 73 | 'label' => Yii::t('hipanel/hosting', 'Requests'), |
||
| 74 | 'icon' => 'fa-tasks', |
||
| 75 | 'url' => ['/hosting/request/index'], |
||
| 76 | ], |
||
| 77 | ], |
||
| 78 | ], |
||
| 79 | ]; |
||
| 80 | } |
||
| 81 | } |
||
| 82 |