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

src/menus/ConfigDetailMenu.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace hipanel\modules\server\menus;
4
5
use Yii;
6
7
class ConfigDetailMenu extends \hipanel\menus\AbstractDetailMenu
8
{
9
    public $model;
10
11
    public function items()
12
    {
13
        $actions = ConfigActionsMenu::create(['model' => $this->model])->items();
14
        $items = array_merge($actions, [
15
            'delete' => [
16
                'label' => Yii::t('hipanel', 'Delete'),
17
                'icon' => 'fa-trash',
18
                'url' => ['@config/delete', 'id' => $this->model->id],
19
                'encode' => false,
20
                'visible' => Yii::$app->user->can('config.delete'),
0 ignored issues
show
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

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

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...
21
                'linkOptions' => [
22
                    'data' => [
23
                        'confirm' => Yii::t('hipanel', 'Are you sure you want to delete this item?'),
24
                        'method' => 'POST',
25
                        'pjax' => '0',
26
                    ],
27
                ],
28
            ],
29
        ]);
30
        unset($items['view']);
31
32
        return $items;
33
    }
34
}
35