Completed
Push — master ( e0d7ad...594a1c )
by Klochok
11:15
created

HdomainGridLegend::items()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 8.9713
c 0
b 0
f 0
cc 1
eloc 11
nc 1
nop 0
1
<?php
2
3
namespace hipanel\modules\hosting\grid;
4
5
use hipanel\widgets\gridLegend\BaseGridLegend;
6
use hipanel\widgets\gridLegend\GridLegendInterface;
7
use Yii;
8
9
class HdomainGridLegend extends BaseGridLegend implements GridLegendInterface
10
{
11
    public function items()
12
    {
13
        return [
14
            [
15
                'label' => Yii::t('hipanel:hosting', 'Domain'),
16
            ],
17
            [
18
                'label' => Yii::t('hipanel:hosting', 'DNS records'),
19
                'color' => '#CCFFCC',
20
            ],
21
            [
22
                'label' => Yii::t('hipanel:hosting', 'Alias'),
23
                'color' => '#CCCCFF',
24
                'rule' => $this->model->vhost_id !== null,
0 ignored issues
show
Bug introduced by
Accessing vhost_id on the interface yii\db\ActiveRecordInterface suggest that you code against a concrete implementation. How about adding an instanceof check?

If you access a property on an interface, you most likely code against a concrete implementation of the interface.

Available Fixes

  1. Adding an additional type check:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeInterface $object) {
        if ($object instanceof SomeClass) {
            $a = $object->a;
        }
    }
    
  2. Changing the type hint:

    interface SomeInterface { }
    class SomeClass implements SomeInterface {
        public $a;
    }
    
    function someFunction(SomeClass $object) {
        $a = $object->a;
    }
    
Loading history...
25
            ],
26
            [
27
                'label' => Yii::t('hipanel:hosting', 'Name server'),
28
                'color' => '#FFFFCC',
29
            ],
30
            [
31
                'label' => Yii::t('hipanel:hosting', 'Complex domain'),
32
            ],
33
        ];
34
    }
35
}
36