Code Duplication    Length = 20-20 lines in 4 locations

src/widgets/account/State.php 1 location

@@ 16-35 (lines=20) @@
13
use hipanel\widgets\Label;
14
use Yii;
15
16
class State extends Label
17
{
18
    public $model = [];
19
20
    public function init()
21
    {
22
        $state = $this->model->state;
23
        if ($state === 'ok' || $state === 'active') {
24
            $class = 'info';
25
        } elseif ($state === 'blocked') {
26
            $class = 'danger';
27
        } else {
28
            $class = 'warning';
29
        }
30
31
        $this->color = $class;
32
        $this->label = Yii::t('hipanel:hosting', $this->model->state_label);
33
        parent::init();
34
    }
35
}
36

src/widgets/db/State.php 1 location

@@ 16-35 (lines=20) @@
13
use hipanel\widgets\Label;
14
use Yii;
15
16
class State extends Label
17
{
18
    public $model = [];
19
20
    public function init()
21
    {
22
        $state = $this->model->state;
23
        if ($state === 'ok') {
24
            $class = 'info';
25
        } elseif ($state === 'blocked') {
26
            $class = 'danger';
27
        } else {
28
            $class = 'warning';
29
        }
30
31
        $this->color = $class;
32
        $this->label = Yii::t('hipanel:hosting', $this->model->state_label);
33
        parent::init();
34
    }
35
}
36

src/widgets/hdomain/State.php 1 location

@@ 16-35 (lines=20) @@
13
use hipanel\widgets\Label;
14
use Yii;
15
16
class State extends Label
17
{
18
    public $model = [];
19
20
    public function init()
21
    {
22
        $state = $this->model->state;
23
        if ($state === 'ok') {
24
            $class = 'info';
25
        } elseif ($state === 'blocked') {
26
            $class = 'danger';
27
        } else {
28
            $class = 'warning';
29
        }
30
31
        $this->color = $class;
32
        $this->label = Yii::t('hipanel:hosting', $this->model->state_label);
33
        parent::init();
34
    }
35
}
36

src/widgets/mail/State.php 1 location

@@ 16-35 (lines=20) @@
13
use hipanel\widgets\Label;
14
use Yii;
15
16
class State extends Label
17
{
18
    public $model = [];
19
20
    public function init()
21
    {
22
        $state = $this->model->state;
23
        if ($state === 'ok') {
24
            $class = 'info';
25
        } elseif ($state === 'blocked') {
26
            $class = 'danger';
27
        } else {
28
            $class = 'warning';
29
        }
30
31
        $this->color = $class;
32
        $this->label = Yii::t('hipanel:hosting', $this->model->state_label);
33
        parent::init();
34
    }
35
}
36