Passed
Push — master ( 662d52...2a8232 )
by eXeCUT
03:58
created

Module.php (2 issues)

Labels
Severity
1
<?php
2
/**
3
 * User: execut
4
 * Date: 13.07.16
5
 * Time: 14:27
6
 */
7
8
namespace execut\import;
9
10
11
use execut\dependencies\PluginBehavior;
12
use execut\import\models\File;
13
use execut\navigation\Component;
14
use kartik\base\TranslationTrait;
15
16
class Module extends \yii\base\Module implements Plugin
17
{
18
    public $controllerNamespace = 'execut\import\controllers';
19
    public function behaviors()
20
    {
21
        return [
22
            [
23
                'class' => PluginBehavior::class,
24
                'pluginInterface' => Plugin::class,
25
            ],
26
        ];
27
    }
28
29
    public function getDictionaries() {
30
        return $this->getPluginsResults(__FUNCTION__);
0 ignored issues
show
The method getPluginsResults() does not exist on execut\import\Module. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

30
        return $this->/** @scrutinizer ignore-call */ getPluginsResults(__FUNCTION__);
Loading history...
31
    }
32
33
    public function getParsersByTypesSettings() {
34
        return $this->getPluginsResults(__FUNCTION__);
35
    }
36
37
    public function getOldIdsByFile(File $importFile) {
38
        return $this->getPluginsResults(__FUNCTION__, false, func_get_args());
39
    }
40
41
    public function getAllowedRoles() {
42
        $results = $this->getPluginsResults(__FUNCTION__);
43
        if ($results === null) {
44
            return [];
45
        }
46
47
        return $results;
48
    }
49
50
    public function isHasAccess() {
51
        $roles = $this->getAllowedRoles();
52
        if ($roles === []) {
53
            return true;
54
        }
55
56
        $user = \yii::$app->user;
57
        foreach ($roles as $role) {
58
            if ($user->can($role)) {
0 ignored issues
show
The method can() does not exist on null. ( Ignorable by Annotation )

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

58
            if ($user->/** @scrutinizer ignore-call */ can($role)) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
59
                return true;
60
            }
61
        }
62
    }
63
64
    public function getFilesCrudFieldsPlugins() {
65
        $results = $this->getPluginsResults(__FUNCTION__);
66
        if ($results === null) {
67
            return [];
68
        }
69
70
        return $results;
71
    }
72
73
    public function getAttributesSetsTypesList() {
74
        $results = $this->getPluginsResults(__FUNCTION__);
75
        if ($results === null) {
76
            return [];
77
        }
78
79
        return $results;
80
    }
81
82
    public function getAttributesValuesTypesList() {
83
        $results = $this->getPluginsResults(__FUNCTION__);
84
        if ($results === null) {
85
            return [];
86
        }
87
88
        return $results;
89
    }
90
91
    public function getSettingsCrudFieldsPlugins() {
92
        $results = $this->getPluginsResults(__FUNCTION__);
93
        if ($results === null) {
94
            return [];
95
        }
96
97
        return $results;
98
    }
99
100
    public function getSettingsSheetsCrudFieldsPlugins() {
101
        $results = $this->getPluginsResults(__FUNCTION__);
102
        if ($results === null) {
103
            return [];
104
        }
105
106
        return $results;
107
    }
108
109
    public function getRequiredAttributesByTypes() {
110
        $results = $this->getPluginsResults(__FUNCTION__);
111
        if ($results === null) {
112
            return [];
113
        }
114
115
        return $results;
116
    }
117
118
    public function bootstrapNavigation(Component $navigation) {
119
        $this->getPluginsResults(__FUNCTION__, false, [$navigation]);
120
    }
121
}