Completed
Push — master ( 220d6b...46dd23 )
by Andrii
06:02 queued 01:48
created

ServerTypeRefCombo   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 12
ccs 0
cts 2
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A prepareData() 0 10 2
1
<?php
2
3
namespace hipanel\modules\server\widgets\combo;
4
5
use hipanel\widgets\RefCombo;
6
use Yii;
7
8
class ServerTypeRefCombo extends RefCombo
9
{
10
    public function prepareData()
11
    {
12
        $refs = parent::prepareData();
13
        if (Yii::$app->user->can('support')) {
0 ignored issues
show
Bug introduced by
The method can() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

13
        if (Yii::$app->user->/** @scrutinizer ignore-call */ can('support')) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
14
            return $refs;
15
        }
16
17
        return array_filter($refs, function ($k) {
18
            return in_array($k, ['dedicated', 'unmanaged']);
19
        }, ARRAY_FILTER_USE_KEY);
20
    }
21
}
22