Completed
Pull Request — master (#142)
by Klochok
13:32
created

ResourceDetailAction::beforePerform()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace hipanel\actions;
4
5
class ResourceDetailAction extends IndexAction
6
{
7
    public function beforePerform()
8
    {
9
        parent::beforePerform();
10
        $query = $this->getDataProvider()->query;
11
        $query->andWhere([
12
            'time_from' => '2020-08-01',
13
            'time_till' => '2020-08-31',
14
        ]);
15
        $query->andWhere([
16
            'object_id' => $this->request->get('id'),
0 ignored issues
show
Documentation introduced by
The property request does not exist on object<hipanel\actions\ResourceDetailAction>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
17
            'groupby' => 'server_traf_day',
18
        ]);
19
    }
20
}