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.
Passed
Push — master ( f4eb79...f57f22 )
by Alexander
09:38
created

EventModule::bootstrap()   D

Complexity

Conditions 9
Paths 11

Size

Total Lines 29
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 29
rs 4.909
cc 9
eloc 19
nc 11
nop 1
1
<?php
2
3
namespace app\modules\event;
4
5
6
use app\components\BaseModule;
7
use app\modules\event\interfaces\EventInterface;
8
use yii\base\Application;
9
use yii\base\BootstrapInterface;
10
11
12
/**
13
 * Class EventModule
14
 * @package app\modules\event
15
 *
16
 * This module provide ability to attach custom handlers to any existing event from any module, even if module itself
17
 * will not be bootstrapped
18
 */
19
class EventModule extends BaseModule implements BootstrapInterface
20
{
21
    /**
22
     * Bootstrap method to be called during application bootstrap stage.
23
     * @param Application $app the application currently running
24
     */
25
    public function bootstrap($app)
26
    {
27
        foreach ($app->modules as $module) {
28
            $class = null;
29
            switch (gettype($module)) {
30
                case "string":
31
                    $class = $module;
32
                    break;
33
34
                case "array":
35
                    if (isset($module["class"])) {
36
                        $class = $module["class"];
37
                    }
38
                    break;
39
40
                case "object":
41
                    $class = get_class($module);
42
                    break;
43
            }
44
45
            if (
46
                $class !== null
47
                && class_exists($class, false)
48
                && in_array(EventInterface::class, class_implements($class, false))
49
            ) {
50
                $class::attachEventsHandlers();
51
            }
52
        }
53
    }
54
}