Completed
Push — master ( 6ff6d1...70482c )
by Alexey
02:17
created
Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace yiicod\auth;
4
5
use Yii;
6
use yii\base\Component;
7
use yii\console\Application;
8
use yii\helpers\ArrayHelper;
9
10
class Auth extends Component
11
{
12
13
    /**
14
     * @var ARRAY model settings
15
     */
16
    public $modelMap = array();
17
18
    /**
19
     * @var array Controllers settings
20
     */
21
    public $controllers = array();
22
23
    /**
24
     *
25
     * @var type 
26
     */
27
    public $authUserBehavior = null;
28
29
    /**
30
     *
31
     * @var type 
32
     */
33
    public $condition = array();
34
35
    public function init()
36
    {
37
        parent::init();
38
39
        //Merge main extension config with local extension config
40
        $config = include(dirname(__FILE__) . '/config/main.php');
41
        foreach ($config as $key => $value) {
42
            if (is_array($value)) {
43
                $this->{$key} = ArrayHelper::merge($value, $this->{$key});
44
            } elseif (null === $this->{$key}) {
45
                $this->{$key} = $value;
46
            }
47
        }
48
49
        if (!Yii::$app instanceof Application) {
0 ignored issues
show
The class yii\console\Application does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
50
            //Merge controllers map
51
            $route = Yii::$app->getRequest()->getPathInfo();
52
            $route = empty($route) ? Yii::$app->getRequest()->getQueryParam('r', '') : $route;
53
            $module = substr($route, 0, strpos($route, '/'));
54
            if (Yii::$app->hasModule($module) && isset($this->controllers['controllerMap'][$module])) {
55
                Yii::$app->getModule($module)->controllerMap = ArrayHelper::merge($this->controllers['controllerMap'][$module], Yii::$app->getModule($module)->controllerMap);
56
            } elseif (isset($this->controllers['controllerMap']['default'])) {
57
                Yii::$app->controllerMap = ArrayHelper::merge($this->controllers['controllerMap']['default'], Yii::$app->controllerMap);
58
            }
59
        }
60
61
        Yii::setAlias('@yiicod', realpath(dirname(__FILE__) . '/..'));
62
    }
63
64
}
65