GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Setup Failed
Push — filters ( b57792...a4afe1 )
by Alexander
11:05
created

PropertyHandler::init()   B

Complexity

Conditions 4
Paths 4

Size

Total Lines 24
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 24
rs 8.6846
cc 4
eloc 14
nc 4
nop 0
1
<?php
2
3
namespace app\backend\actions;
4
5
use app\models\Object;
6
use app\models\Property;
7
use app\properties\PropertyHandlers;
8
use yii;
9
use yii\base\Action;
10
11
class PropertyHandler extends Action
12
{
13
    public $modelName = null;
14
    public $objectId = null;
15
16
    /**
17
     * @throws yii\web\ServerErrorHttpException
18
     */
19
    public function init()
20
    {
21
        parent::init();
22
        \yii\helpers\VarDumper::dump(
23
            [
24
                'modelname' => $this->modelName
25
            ],
26
            10,
27
            true
28
        );
29
        \Yii::$app->end();
30
        if (null === $this->modelName) {
31
            throw new yii\web\ServerErrorHttpException('Model name should be set in controller actions');
32
        }
33
34
        if (!is_subclass_of($this->modelName, '\yii\db\ActiveRecord')) {
0 ignored issues
show
Bug introduced by
Due to PHP Bug #53727, is_subclass_of returns inconsistent results on some PHP versions for interfaces; you could instead use ReflectionClass::implementsInterface.
Loading history...
35
            throw new yii\web\ServerErrorHttpException('Model class does not exists');
36
        }
37
38
        $this->objectId = Object::getForClass($this->modelName);
39
        if (null === $this->objectId) {
40
            throw new yii\web\ServerErrorHttpException('Object does not exists for model.');
41
        }
42
    }
43
44
    /**
45
     * @param null $property_id
46
     * @param null $handler_action
47
     * @param null $model_id
48
     * @return mixed
49
     */
50
    public function run($property_id = null, $handler_action = null, $model_id = null)
51
    {
52
        if (null === $handler_action
53
            || null === $property_id
54
            || null === $model_id)
55
        {
56
            return '';
57
        }
58
59
        $property = Property::findById($property_id);
60
        if (null === $property) {
61
            return '';
62
        }
63
64
        $actionParams = [
65
            'model_name' => $this->modelName,
66
            'model_id' => $model_id,
67
            'object_id' => $this->objectId,
68
            'property' => $property,
69
        ];
70
        $propertyHandler = PropertyHandlers::createHandler($property->handler);
71
        return $propertyHandler->runAction($handler_action, $actionParams);
72
    }
73
}
74
?>