ServerStateRefCombo::prepareData()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 10
ccs 0
cts 2
cp 0
rs 10
cc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace hipanel\modules\server\widgets\combo;
4
5
use hipanel\widgets\RefCombo;
6
use Yii;
7
8
class ServerStateRefCombo extends RefCombo
9
{
10
    public function prepareData()
11
    {
12
        $refs = parent::prepareData();
13
        if (Yii::$app->user->can('ref.view.not-used')) {
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('ref.view.not-used')) {

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, ['setuping', 'error', 'ok']);
19
        }, ARRAY_FILTER_USE_KEY);
20
    }
21
}
22