Conditions | 5 |
Paths | 5 |
Total Lines | 21 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | public function init() |
||
30 | { |
||
31 | $expires = $this->model->expires; |
||
|
|||
32 | $this->label = Yii::t('hipanel:server', '(not sold)'); |
||
33 | |||
34 | if (!empty($expires)) { |
||
35 | if (strtotime($expires) < time()) { |
||
36 | $class = 'danger'; |
||
37 | } elseif (strtotime($expires) < strtotime('+5 days', time())) { |
||
38 | $class = 'warning'; |
||
39 | } elseif (strtotime($expires) < strtotime('+30 days', time())) { |
||
40 | $class = 'info'; |
||
41 | } else { |
||
42 | $class = 'default'; |
||
43 | } |
||
44 | |||
45 | $this->color = $class; |
||
46 | $this->label = Yii::$app->formatter->asDate($expires); |
||
47 | } |
||
48 | |||
49 | parent::init(); |
||
50 | } |
||
52 |