Backend   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 31
dl 0
loc 65
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDefaultDepends() 0 17 1
A bootstrap() 0 4 1
A bootstrapNavigation() 0 29 2
1
<?php
2
namespace execut\import\bootstrap;
3
use execut\actions\Bootstrap;
4
use execut\crud\navigation\Configurator;
5
use execut\import\models\File;
6
use execut\import\models\Setting;
7
use execut\import\Module;
8
use execut\navigation\Component;
9
use execut\navigation\configurator\HomePage;
10
use yii\helpers\ArrayHelper;
11
use yii\i18n\PhpMessageSource;
12
13
class Backend extends Common
14
{
15
    public function getDefaultDepends()
16
    {
17
        return ArrayHelper::merge(parent::getDefaultDepends(), [
18
            'components' => [
19
                'navigation' => [
20
                    'class' => Component::class,
21
                ],
22
            ],
23
            'bootstrap' => [
24
                'navigation' => [
25
                    'class' => \execut\navigation\Bootstrap::class,
26
                ],
27
                'actions' => [
28
                    'class' => Bootstrap::class,
29
                ],
30
                'crud' => [
31
                    'class' => \execut\crud\Bootstrap::class,
32
                ],
33
            ],
34
        ]);
35
    }
36
37
    /**
38
     * @param \yii\base\Application $app
39
     */
40
    public function bootstrap($app)
41
    {
42
        parent::bootstrap($app);
43
        $this->bootstrapNavigation($app);
44
    }
45
46
    /**
47
     * @param $app
48
     */
49
    protected function bootstrapNavigation($app)
50
    {
51
        $importModule = $app->getModule('import');
52
        if (!$importModule->isHasAccess()) {
53
            return;
54
        }
55
56
        /**
57
         * @var Component $navigation
58
         */
59
        $navigation = $app->navigation;
60
61
        $navigation->addConfigurator([
62
            'class' => Configurator::class,
63
            'module' => 'import',
64
            'moduleName' => 'Import',
65
            'modelName' => File::MODEL_NAME,
66
            'controller' => 'files',
67
        ]);
68
69
        $navigation->addConfigurator([
70
            'class' => Configurator::class,
71
            'module' => 'import',
72
            'moduleName' => 'Import',
73
            'modelName' => Setting::MODEL_NAME,
74
            'controller' => 'settings',
75
        ]);
76
77
        $importModule->bootstrapNavigation($navigation);
78
    }
79
}