Completed
Push — master ( 14bb08...9de373 )
by Dmitry
11:17
created

ServerNameBadge   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
eloc 8
dl 0
loc 14
ccs 0
cts 1
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 9 1
1
<?php
2
3
namespace hipanel\modules\server\widgets;
4
5
use hipanel\modules\server\grid\ServerGridLegend;
6
use hipanel\modules\server\models\Server;
7
use hipanel\widgets\gridLegend\GridLegend;
8
use yii\base\Widget;
9
10
/**
11
 * Class ServerNameBadge
12
 *
13
 * @author Dmytro Naumenko <[email protected]>
14
 */
15
class ServerNameBadge extends Widget
16
{
17
    /** @var Server */
18
    public $model;
19
20
    public function run()
21
    {
22
        $color = GridLegend::create(new ServerGridLegend($this->model))->gridColumnOptions('actions');
23
        $colorString = implode(';', $color);
24
25
        $this->view->registerCss('.badge .server-badge-text { color: #bbbbbb; mix-blend-mode: difference; }');
26
27
        return <<<HTML
28
<span class="badge" style="$colorString"><span class="server-badge-text">{$this->model->name}</span></span>
29
HTML
30
            ;
31
    }
32
}
33