Completed
Push — master ( f04bdf...03085f )
by Andrii
05:00
created

ConfigActionsMenu::items()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 14
ccs 0
cts 13
cp 0
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Server module for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-server
6
 * @package   hipanel-module-server
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
namespace hipanel\modules\server\menus;
11
12
use Yii;
13
14
class ConfigActionsMenu extends \hiqdev\yii2\menus\Menu
15
{
16
    public $model;
17
18
    public function items()
19
    {
20
        return [
21
            'view' => [
22
                'label' => Yii::t('hipanel', 'View'),
23
                'icon' => 'fa-info',
24
                'url' => ['@config/view', 'id' => $this->model->id],
25
                'visible' => Yii::$app->user->can('config.read'),
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

25
                'visible' => Yii::$app->user->/** @scrutinizer ignore-call */ can('config.read'),

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...
26
            ],
27
            'update' => [
28
                'label' => Yii::t('hipanel', 'Update'),
29
                'icon' => 'fa-pencil',
30
                'url' => ['@config/update', 'id' => $this->model->id],
31
                'visible' => Yii::$app->user->can('config.update'),
32
            ],
33
        ];
34
    }
35
}
36