| Conditions | 4 |
| Paths | 6 |
| Total Lines | 20 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | public function run() |
||
| 38 | { |
||
| 39 | if ($this->model->state !== 'blocked') { |
||
| 40 | $value = Yii::$app->formatter->asDate($this->model->expires); |
||
| 41 | } else { |
||
| 42 | $value = Yii::t('hipanel:server', 'Blocked {reason}', ['reason' => Yii::t('hipanel:block-reasons', $this->model->block_reason_label)]); |
||
| 43 | } |
||
| 44 | |||
| 45 | $class = ['label']; |
||
| 46 | |||
| 47 | if (strtotime('+7 days', time()) < strtotime($this->model->expires)) { |
||
| 48 | $class[] = 'label-info'; |
||
| 49 | } elseif (strtotime('+3 days', time()) < strtotime($this->model->expires)) { |
||
| 50 | $class[] = 'label-warning'; |
||
| 51 | } else { |
||
| 52 | $class[] = 'label-danger'; |
||
| 53 | } |
||
| 54 | $html = Html::tag('span', $value, ['class' => implode(' ', $class)]); |
||
| 55 | |||
| 56 | return $html; |
||
| 57 | } |
||
| 59 |