| Conditions | 1 |
| Paths | 1 |
| Total Lines | 138 |
| Code Lines | 77 |
| 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 |
||
| 11 | public function items() |
||
| 12 | { |
||
| 13 | return [ |
||
| 14 | [ |
||
| 15 | 'label' => Yii::t('hipanel:server', 'unused'), |
||
| 16 | ], |
||
| 17 | [ |
||
| 18 | 'label' => Yii::t('hipanel:server', 'setup'), |
||
| 19 | ], |
||
| 20 | [ |
||
| 21 | 'label' => Yii::t('hipanel:server', 'delivery'), |
||
| 22 | 'color' => '#50c878', |
||
| 23 | 'rule' => $this->model->type === 'delivery', |
||
| 24 | ], |
||
| 25 | [ |
||
| 26 | 'label' => Yii::t('hipanel:server', 'reserved'), |
||
| 27 | 'color' => '#339966', |
||
| 28 | 'rule' => $this->model->type === 'reserved', |
||
| 29 | ], |
||
| 30 | [ |
||
| 31 | 'label' => Yii::t('hipanel:server', 'dedicated'), |
||
| 32 | 'color' => '#AAFFAA', |
||
| 33 | 'rule' => $this->model->type === 'dedicated', |
||
| 34 | ], |
||
| 35 | [ |
||
| 36 | 'label' => Yii::t('hipanel:server', 'unmanaged'), |
||
| 37 | 'color' => '#AAFFAA', |
||
| 38 | 'rule' => $this->model->type === 'unmanaged', |
||
| 39 | ], |
||
| 40 | [ |
||
| 41 | 'label' => Yii::t('hipanel:server', 'virtual'), |
||
| 42 | 'color' => '#CCCCFF', |
||
| 43 | 'rule' => $this->model->type === 'virtual', |
||
| 44 | ], |
||
| 45 | [ |
||
| 46 | 'label' => Yii::t('hipanel:server', 'system'), |
||
| 47 | 'color' => '#FFFF99', |
||
| 48 | 'rule' => $this->model->type === 'system', |
||
| 49 | ], |
||
| 50 | [ |
||
| 51 | 'label' => Yii::t('hipanel:server', 'remote'), |
||
| 52 | 'color' => '#CCFFCC', |
||
| 53 | 'rule' => $this->model->type === 'remote', |
||
| 54 | ], |
||
| 55 | [ |
||
| 56 | 'label' => Yii::t('hipanel:server', 'vds'), |
||
| 57 | 'color' => '#FFBB00', |
||
| 58 | 'rule' => $this->model->type === 'vds', |
||
| 59 | ], |
||
| 60 | [ |
||
| 61 | 'label' => Yii::t('hipanel:server', 'avdsnode'), |
||
| 62 | 'color' => '#b8860b', |
||
| 63 | 'rule' => $this->model->type === 'avdsnode', |
||
| 64 | ], |
||
| 65 | [ |
||
| 66 | 'label' => Yii::t('hipanel:server', 'avds'), |
||
| 67 | 'color' => '#eedc82', |
||
| 68 | 'rule' => $this->model->type === 'avds', |
||
| 69 | ], |
||
| 70 | [ |
||
| 71 | 'label' => Yii::t('hipanel:server', 'ovds'), |
||
| 72 | ], |
||
| 73 | [ |
||
| 74 | 'label' => Yii::t('hipanel:server', 'svds'), |
||
| 75 | ], |
||
| 76 | [ |
||
| 77 | 'label' => Yii::t('hipanel:server', 'cdn'), |
||
| 78 | 'color' => '#6699FF', |
||
| 79 | 'rule' => $this->model->type === 'cdn', |
||
| 80 | ], |
||
| 81 | [ |
||
| 82 | 'label' => Yii::t('hipanel:server', 'cdnv2'), |
||
| 83 | 'color' => '#6699FF', |
||
| 84 | 'rule' => $this->model->type === 'cdnv2', |
||
| 85 | ], |
||
| 86 | [ |
||
| 87 | 'label' => Yii::t('hipanel:server', 'cdnpix'), |
||
| 88 | 'color' => '#c9a0dc', |
||
| 89 | 'rule' => $this->model->type === 'cdnpix', |
||
| 90 | ], |
||
| 91 | [ |
||
| 92 | 'label' => Yii::t('hipanel:server', 'cdnstat'), |
||
| 93 | 'color' => '#c9a0dc', |
||
| 94 | 'rule' => $this->model->type === 'cdnstat', |
||
| 95 | ], |
||
| 96 | [ |
||
| 97 | 'label' => Yii::t('hipanel:server', 'cloudstorage'), |
||
| 98 | 'color' => '#aaccee', |
||
| 99 | 'rule' => $this->model->type === 'cloudstorage', |
||
| 100 | ], |
||
| 101 | [ |
||
| 102 | 'label' => Yii::t('hipanel:server', 'jail'), |
||
| 103 | 'color' => '#AAFFFF', |
||
| 104 | 'rule' => $this->model->type === 'jail', |
||
| 105 | ], |
||
| 106 | [ |
||
| 107 | 'label' => Yii::t('hipanel:server', 'nic'), |
||
| 108 | 'color' => '#FFFFDD', |
||
| 109 | 'rule' => $this->model->type === 'nic', |
||
| 110 | ], |
||
| 111 | [ |
||
| 112 | 'label' => Yii::t('hipanel:server', 'uplink1'), |
||
| 113 | 'color' => '#EBEBCD', |
||
| 114 | 'rule' => $this->model->type === 'uplink1', |
||
| 115 | ], |
||
| 116 | [ |
||
| 117 | 'label' => Yii::t('hipanel:server', 'uplink2'), |
||
| 118 | 'color' => '#EBEBCD', |
||
| 119 | 'rule' => $this->model->type === 'uplink2', |
||
| 120 | ], |
||
| 121 | [ |
||
| 122 | 'label' => Yii::t('hipanel:server', 'uplink3'), |
||
| 123 | 'color' => '#EBEBCD', |
||
| 124 | 'rule' => $this->model->type === 'uplink3', |
||
| 125 | ], |
||
| 126 | [ |
||
| 127 | 'label' => Yii::t('hipanel:server', 'total'), |
||
| 128 | 'color' => '#a3a375', |
||
| 129 | 'rule' => $this->model->type === 'total', |
||
| 130 | ], |
||
| 131 | [ |
||
| 132 | 'label' => Yii::t('hipanel:server', 'transit'), |
||
| 133 | 'color' => '#EBEBCD', |
||
| 134 | 'rule' => $this->model->type === 'transit', |
||
| 135 | ], |
||
| 136 | [ |
||
| 137 | 'label' => Yii::t('hipanel:server', 'stock'), |
||
| 138 | ], |
||
| 139 | [ |
||
| 140 | 'label' => Yii::t('hipanel:server', 'deleted'), |
||
| 141 | 'color' => '#CCCCCC', |
||
| 142 | 'rule' => $this->model->type === 'deleted', |
||
| 143 | ], |
||
| 144 | [ |
||
| 145 | 'label' => Yii::t('hipanel:server', 'office'), |
||
| 146 | ], |
||
| 147 | ]; |
||
| 148 | } |
||
| 149 | } |
||
| 150 |