IpTag   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 27
ccs 0
cts 20
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B init() 0 22 6
1
<?php
2
/**
3
 * Hosting Plugin for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-hosting
6
 * @package   hipanel-module-hosting
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\hosting\widgets\ip;
12
13
use hipanel\widgets\Label;
14
use Yii;
15
16
class IpTag extends Label
17
{
18
    public $tag = '';
19
20
    public function init()
21
    {
22
        $tag = $this->tag;
23
24
        if ($tag === 'static') {
25
            $class = 'success';
26
        } elseif ($tag === 'aux') {
27
            $class = 'default';
28
        } elseif ($tag === 'gateway') {
29
            $class = 'primary';
30
        } elseif ($tag === 'movement') {
31
            $class = 'danger';
32
        } elseif ($tag === 'anycast') {
33
            $class = 'info';
34
        } else {
35
            $class = 'default';
36
        }
37
38
        $this->color = $class;
0 ignored issues
show
Bug introduced by
The property color does not seem to exist. Did you mean _color?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
39
        $this->label = Yii::t('hipanel:hosting', $tag);
0 ignored issues
show
Bug introduced by
The property label does not seem to exist. Did you mean _label?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
40
        parent::init();
41
    }
42
}
43