Issues (213)

src/models/query/HubQuery.php (1 issue)

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\models\query;
12
13
use hiqdev\hiart\ActiveQuery;
14
use Yii;
15
16
class HubQuery extends ActiveQuery
17
{
18
    public function withBindings(): self
19
    {
20
        if (Yii::$app->user->can('hub.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

20
        if (Yii::$app->user->/** @scrutinizer ignore-call */ can('hub.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...
21
            $this->joinWith('bindings');
22
            $this->andWhere(['with_bindings' => true]);
23
        }
24
25
        return $this;
26
    }
27
28
    public function withMonitoringSettings(): self
29
    {
30
        if (Yii::$app->user->can('server.manage-settings')) {
31
            $this->joinWith(['monitoringSettings']);
32
            $this->andWhere(['with_monitoringSettings' => 1]);
33
        }
34
35
        return $this;
36
    }
37
}
38