Completed
Push — master ( 807735...69ceb8 )
by Igor
02:38
created
components/AccessHelper.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
     /**
72 72
      * Get controller routes
73 73
      * @param $module
74
-     * @param $namespace
75
-     * @param $prefix
74
+     * @param string $namespace
75
+     * @param string $prefix
76 76
      * @param $result
77 77
      * @throws \yii\base\InvalidConfigException
78 78
      */
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     /**
130 130
      * Get group
131 131
      *
132
-     * @param $group
132
+     * @param string $group
133 133
      * @return string
134 134
      */
135 135
     private static function getGroup($group)
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     /**
141 141
      * Build key
142 142
      *
143
-     * @param $key
143
+     * @param string $key
144 144
      * @return array
145 145
      */
146 146
     private static function buildKey($key)
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
                 $module
61 61
             ]);
62 62
             self::getActionRoutes($controller, $result);
63
-            $result[] = '/' . $controller->uniqueId . '/*';
63
+            $result[] = '/'.$controller->uniqueId.'/*';
64 64
         }
65 65
 
66
-        $namespace = trim($module->controllerNamespace, '\\') . '\\';
66
+        $namespace = trim($module->controllerNamespace, '\\').'\\';
67 67
         self::getControllerRoutes($module, $namespace, '', $result);
68
-        $result[] = ($module->uniqueId === '' ? '' : '/' . $module->uniqueId) . '/*';
68
+        $result[] = ($module->uniqueId === '' ? '' : '/'.$module->uniqueId).'/*';
69 69
     }
70 70
 
71 71
     /**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      */
79 79
     private static function getControllerRoutes($module, $namespace, $prefix, &$result)
80 80
     {
81
-        $path = Yii::getAlias('@' . str_replace('\\', '/', $namespace));
81
+        $path = Yii::getAlias('@'.str_replace('\\', '/', $namespace));
82 82
         if (!is_dir($path)) {
83 83
             return;
84 84
         }
@@ -86,18 +86,18 @@  discard block
 block discarded – undo
86 86
             if ($file == '.' || $file == '..') {
87 87
                 continue;
88 88
             }
89
-            if (is_dir($path . '/' . $file)) {
90
-                self::getControllerRoutes($module, $namespace . $file . '\\', $prefix . $file . '/', $result);
89
+            if (is_dir($path.'/'.$file)) {
90
+                self::getControllerRoutes($module, $namespace.$file.'\\', $prefix.$file.'/', $result);
91 91
             } elseif (strcmp(substr($file, -14), 'Controller.php') === 0) {
92 92
                 $id = Inflector::camel2id(substr(basename($file), 0, -14));
93
-                $className = $namespace . Inflector::id2camel($id) . 'Controller';
93
+                $className = $namespace.Inflector::id2camel($id).'Controller';
94 94
                 if (strpos($className, '-') === false && class_exists($className) && is_subclass_of($className, 'yii\base\Controller')) {
95 95
                     $controller = Yii::createObject($className, [
96
-                        $prefix . $id,
96
+                        $prefix.$id,
97 97
                         $module
98 98
                     ]);
99 99
                     self::getActionRoutes($controller, $result);
100
-                    $result[] = '/' . $controller->uniqueId . '/*';
100
+                    $result[] = '/'.$controller->uniqueId.'/*';
101 101
                 }
102 102
             }
103 103
         }
@@ -111,16 +111,16 @@  discard block
 block discarded – undo
111 111
      */
112 112
     private static function getActionRoutes($controller, &$result)
113 113
     {
114
-        $prefix = '/' . $controller->uniqueId . '/';
114
+        $prefix = '/'.$controller->uniqueId.'/';
115 115
         if ($controller->actions() !== null) {
116 116
             foreach ($controller->actions() as $id => $value) {
117
-                $result[] = $prefix . $id;
117
+                $result[] = $prefix.$id;
118 118
             }
119 119
             $class = new ReflectionClass($controller);
120 120
             foreach ($class->getMethods() as $method) {
121 121
                 $name = $method->getName();
122 122
                 if ($method->isPublic() && !$method->isStatic() && strpos($name, 'action') === 0 && $name !== 'actions') {
123
-                    $result[] = $prefix . Inflector::camel2id(substr($name, 6));
123
+                    $result[] = $prefix.Inflector::camel2id(substr($name, 6));
124 124
                 }
125 125
             }
126 126
         }
Please login to merge, or discard this patch.
components/AccessControl.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@
 block discarded – undo
28 28
         $actionId = $action->getUniqueId();
29 29
         $user = Yii::$app->getUser();
30 30
         $params = isset($this->params[$action->id]) ? $this->params[$action->id] : [];
31
-        if ($user->can('/' . $actionId, $params)) {
31
+        if ($user->can('/'.$actionId, $params)) {
32 32
             return true;
33 33
         }
34 34
         $controller = $action->controller;
35 35
         do {
36
-            if ($user->can('/' . ltrim($controller->getUniqueId() . '/*', '/'))) {
36
+            if ($user->can('/'.ltrim($controller->getUniqueId().'/*', '/'))) {
37 37
                 return true;
38 38
             }
39 39
             $controller = $controller->module;
Please login to merge, or discard this patch.
migrations/m141223_164316_init_rbac.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
         }
15 15
 
16 16
         $this->createTable('{{%AuthRule}}', [
17
-            'name' => Schema::TYPE_STRING . '(64) NOT NULL',
17
+            'name' => Schema::TYPE_STRING.'(64) NOT NULL',
18 18
             'data' => Schema::TYPE_TEXT,
19 19
             'created_at' => Schema::TYPE_INTEGER,
20 20
             'updated_at' => Schema::TYPE_INTEGER,
@@ -22,32 +22,32 @@  discard block
 block discarded – undo
22 22
         ], $tableOptions);
23 23
 
24 24
         $this->createTable('{{%AuthItem}}', [
25
-            'name' => Schema::TYPE_STRING . '(64) NOT NULL',
26
-            'type' => Schema::TYPE_INTEGER . ' NOT NULL',
25
+            'name' => Schema::TYPE_STRING.'(64) NOT NULL',
26
+            'type' => Schema::TYPE_INTEGER.' NOT NULL',
27 27
             'description' => Schema::TYPE_TEXT,
28
-            'rule_name' => Schema::TYPE_STRING . '(64)',
28
+            'rule_name' => Schema::TYPE_STRING.'(64)',
29 29
             'data' => Schema::TYPE_TEXT,
30 30
             'created_at' => Schema::TYPE_INTEGER,
31 31
             'updated_at' => Schema::TYPE_INTEGER,
32 32
             'PRIMARY KEY (name)',
33
-            'FOREIGN KEY (rule_name) REFERENCES ' . '{{%AuthRule}}' . ' (name) ON DELETE SET NULL ON UPDATE CASCADE',
33
+            'FOREIGN KEY (rule_name) REFERENCES '.'{{%AuthRule}}'.' (name) ON DELETE SET NULL ON UPDATE CASCADE',
34 34
         ], $tableOptions);
35 35
         $this->createIndex('idx-auth_item-type', '{{%AuthItem}}', 'type');
36 36
 
37 37
         $this->createTable('{{%AuthItemChild}}', [
38
-            'parent' => Schema::TYPE_STRING . '(64) NOT NULL',
39
-            'child' => Schema::TYPE_STRING . '(64) NOT NULL',
38
+            'parent' => Schema::TYPE_STRING.'(64) NOT NULL',
39
+            'child' => Schema::TYPE_STRING.'(64) NOT NULL',
40 40
             'PRIMARY KEY (parent, child)',
41
-            'FOREIGN KEY (parent) REFERENCES ' . '{{%AuthItem}}' . ' (name) ON DELETE CASCADE ON UPDATE CASCADE',
42
-            'FOREIGN KEY (child) REFERENCES ' . '{{%AuthItem}}' . ' (name) ON DELETE CASCADE ON UPDATE CASCADE',
41
+            'FOREIGN KEY (parent) REFERENCES '.'{{%AuthItem}}'.' (name) ON DELETE CASCADE ON UPDATE CASCADE',
42
+            'FOREIGN KEY (child) REFERENCES '.'{{%AuthItem}}'.' (name) ON DELETE CASCADE ON UPDATE CASCADE',
43 43
         ], $tableOptions);
44 44
 
45 45
         $this->createTable('{{%AuthAssignment}}', [
46
-            'item_name' => Schema::TYPE_STRING . '(64) NOT NULL',
47
-            'user_id' => Schema::TYPE_INTEGER . ' NOT NULL',
46
+            'item_name' => Schema::TYPE_STRING.'(64) NOT NULL',
47
+            'user_id' => Schema::TYPE_INTEGER.' NOT NULL',
48 48
             'created_at' => Schema::TYPE_INTEGER,
49 49
             'PRIMARY KEY (item_name, user_id)',
50
-            'FOREIGN KEY (item_name) REFERENCES ' . '{{%AuthItem}}' . ' (name) ON DELETE CASCADE ON UPDATE CASCADE',
50
+            'FOREIGN KEY (item_name) REFERENCES '.'{{%AuthItem}}'.' (name) ON DELETE CASCADE ON UPDATE CASCADE',
51 51
         ], $tableOptions);
52 52
 
53 53
     }
Please login to merge, or discard this patch.
views/route/index.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
                     'class' => 'role-search form-control',
23 23
                     'data-target' => 'available',
24 24
                     'placeholder' => 'New:'
25
-                ]) . ' ';
25
+                ]).' ';
26 26
             echo '<br>';
27 27
             echo Html::listBox('routes', '', $new, [
28 28
                 'id' => 'available',
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
                     'class' => 'role-search form-control',
54 54
                     'data-target' => 'assigned',
55 55
                     'placeholder' => 'Exists:'
56
-                ]) . '<br>'; ?>
56
+                ]).'<br>'; ?>
57 57
             <?php echo Html::listBox('routes', '', $exists, [
58 58
                 'id' => 'assigned',
59 59
                 'multiple' => true,
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 <?php
70 70
 
71 71
 $this->registerJs("rbac.init({
72
-        name: " . json_encode(isset($name) ? $name : []) . ",
73
-        route: '" . Url::toRoute(['route-search']) . "',
74
-        routeAssign: '" . Url::toRoute(['assign', 'action' => 'assign']) . "',
75
-        routeDelete: '" . Url::toRoute(['assign', 'action' => 'delete']) . "',
76
-        routeSearch: '" . Url::toRoute(['route-search']) . "',
72
+        name: " . json_encode(isset($name) ? $name : []).",
73
+        route: '" . Url::toRoute(['route-search'])."',
74
+        routeAssign: '" . Url::toRoute(['assign', 'action' => 'assign'])."',
75
+        routeDelete: '" . Url::toRoute(['assign', 'action' => 'delete'])."',
76
+        routeSearch: '" . Url::toRoute(['route-search'])."',
77 77
     });", yii\web\View::POS_READY);
78 78
\ No newline at end of file
Please login to merge, or discard this patch.
views/route/generate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
     'columns' => [
29 29
         [
30 30
             'class' => 'yii\\grid\\CheckboxColumn',
31
-            'checkboxOptions' => function ($model) {
31
+            'checkboxOptions' => function($model) {
32 32
                     return [
33 33
                         'value' => ArrayHelper::getValue($model, 'name'),
34 34
                         'checked' => true,
Please login to merge, or discard this patch.
views/route/_routes.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     'columns' => [
18 18
         [
19 19
             'class' => 'yii\\grid\\CheckboxColumn',
20
-            'checkboxOptions' => function ($model) use ($type) {
20
+            'checkboxOptions' => function($model) use ($type) {
21 21
                     return [
22 22
                         'value' => ArrayHelper::getValue($model, 'name'),
23 23
                         'checked' => $type == 1 ? true : !ArrayHelper::getValue($model, 'exists', false)
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         [
28 28
             'class' => 'yii\\grid\\DataColumn',
29 29
             'attribute' => 'name',
30
-            'contentOptions' => function ($model) {
30
+            'contentOptions' => function($model) {
31 31
                     return ArrayHelper::getValue($model, 'exists', true) ? [] : ['style' => 'text-decoration: line-through;'];
32 32
                 }
33 33
         ]
Please login to merge, or discard this patch.
views/role/update.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  * @var yii\web\View                 $this
7 7
  * @var yii2mod\rbac\models\AuthItem $model
8 8
  */
9
-$this->title = 'Update Role: ' . $model->name;
9
+$this->title = 'Update Role: '.$model->name;
10 10
 $this->params['breadcrumbs'][] = [
11 11
     'label' => 'Roles',
12 12
     'url' => ['index']
Please login to merge, or discard this patch.
views/assignment/view.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
                         'class' => 'role-search form-control',
24 24
                         'data-target' => 'available',
25 25
                         'placeholder' => 'Search:'
26
-                    ]) . '<br>';
26
+                    ]).'<br>';
27 27
                 echo Html::listBox('roles', '', $available, [
28 28
                     'id' => 'available',
29 29
                     'multiple' => true,
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
                         'class' => 'role-search form-control',
56 56
                         'data-target' => 'assigned',
57 57
                         'placeholder' => 'Search:'
58
-                    ]) . '<br>';
58
+                    ]).'<br>';
59 59
                 echo Html::listBox('roles', '', $assigned, [
60 60
                     'id' => 'assigned',
61 61
                     'multiple' => true,
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
     </div>
70 70
 <?php
71 71
 $this->registerJs("rbac.init({
72
-        name: " . json_encode($id) . ",
73
-        route: '" . Url::toRoute(['role-search']) . "',
74
-        routeAssign: '" . Url::toRoute(['assign', 'id' => $id, 'action' => 'assign']) . "',
75
-        routeDelete: '" . Url::toRoute(['assign', 'id' => $id, 'action' => 'delete']) . "',
76
-        routeSearch: '" . Url::toRoute(['route-search']) . "'
72
+        name: " . json_encode($id).",
73
+        route: '" . Url::toRoute(['role-search'])."',
74
+        routeAssign: '" . Url::toRoute(['assign', 'id' => $id, 'action' => 'assign'])."',
75
+        routeDelete: '" . Url::toRoute(['assign', 'id' => $id, 'action' => 'delete'])."',
76
+        routeSearch: '" . Url::toRoute(['route-search'])."'
77 77
     });", yii\web\View::POS_READY);
Please login to merge, or discard this patch.
views/permission/view.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                         'class' => 'role-search form-control',
49 49
                         'data-target' => 'available',
50 50
                         'placeholder' => 'Search:'
51
-                    ]) . '<br>';
51
+                    ]).'<br>';
52 52
                 echo Html::listBox('roles', '', $available, [
53 53
                     'id' => 'available',
54 54
                     'multiple' => true,
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                         'class' => 'role-search form-control',
80 80
                         'data-target' => 'assigned',
81 81
                         'placeholder' => 'Search:'
82
-                    ]) . '<br>';
82
+                    ]).'<br>';
83 83
                 echo Html::listBox('roles', '', $assigned, [
84 84
                     'id' => 'assigned',
85 85
                     'multiple' => true,
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
     </div>
94 94
 <?php
95 95
 $this->registerJs("rbac.init({
96
-        name: " . json_encode($model->name) . ",
97
-        route: '" . Url::toRoute(['role-search']) . "',
98
-        routeAssign: '" . Url::toRoute(['assign', 'id' => $model->name, 'action' => 'assign']) . "',
99
-        routeDelete: '" . Url::toRoute(['assign', 'id' => $model->name, 'action' => 'delete']) . "',
100
-        routeSearch: '" . Url::toRoute(['route-search']) . "',
96
+        name: " . json_encode($model->name).",
97
+        route: '" . Url::toRoute(['role-search'])."',
98
+        routeAssign: '" . Url::toRoute(['assign', 'id' => $model->name, 'action' => 'assign'])."',
99
+        routeDelete: '" . Url::toRoute(['assign', 'id' => $model->name, 'action' => 'delete'])."',
100
+        routeSearch: '" . Url::toRoute(['route-search'])."',
101 101
     });", yii\web\View::POS_READY);
102 102
 
Please login to merge, or discard this patch.