Issues (213)

src/menus/DashboardItem.php (2 issues)

Labels
Severity
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
11
namespace hipanel\modules\server\menus;
12
13
use hipanel\modules\dashboard\DashboardInterface;
0 ignored issues
show
The type hipanel\modules\dashboard\DashboardInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Yii;
15
16
class DashboardItem extends \hiqdev\yii2\menus\Menu
17
{
18
    protected $dashboard;
19
20
    public function __construct(DashboardInterface $dashboard, $config = [])
21
    {
22
        $this->dashboard = $dashboard;
23
        parent::__construct($config);
24
    }
25
26
    public function items()
27
    {
28
        return [
29
            'servers' => [
30
                'label' => $this->render('dashboardItem', $this->dashboard->mget(['totalCount', 'model'])),
31
                'encode' => false,
32
                'visible' => Yii::$app->user->can('server.read'),
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

32
                'visible' => Yii::$app->user->/** @scrutinizer ignore-call */ can('server.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...
33
            ],
34
        ];
35
    }
36
}
37