Bootstrap   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A bootstrap() 0 10 4
1
<?php
2
3
4
namespace carono\exchange1c;
5
6
7
use carono\exchange1c\helpers\ModuleHelper;
8
use yii\base\Application;
9
use yii\base\BootstrapInterface;
10
use Yii;
11
12
class Bootstrap implements BootstrapInterface
13
{
14
15
    /**
16
     * Bootstrap method to be called during application bootstrap stage.
17
     *
18
     * @param Application $app the application currently running
19
     */
20
    public function bootstrap($app)
21
    {
22
        /**
23
         * @var ExchangeModule $module
24
         */
25
        if ($id = ModuleHelper::getModuleNameByClass()) {
26
            $module = Yii::$app->getModule($id);
27
            if ($module && $module->bootstrapUrlRule) {
28
                Yii::$app->urlManager->enablePrettyUrl = true;
29
                Yii::$app->urlManager->addRules([new UrlRule], $module->appendRule);
0 ignored issues
show
Bug introduced by
It seems like $module->appendRule can also be of type object; however, parameter $append of yii\web\UrlManager::addRules() does only seem to accept boolean, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

29
                Yii::$app->urlManager->addRules([new UrlRule], /** @scrutinizer ignore-type */ $module->appendRule);
Loading history...
30
            }
31
        }
32
    }
33
34
    public function __construct()
35
    {
36
    }
37
}