Completed
Push — master ( 13de46...ceb93d )
by Misbahul D
04:09
created
components/AccessControl.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $actionId = $action->getUniqueId();
69 69
         $user = $this->getUser();
70
-        if (Helper::checkRoute('/' . $actionId, Yii::$app->getRequest()->get(), $user)) {
70
+        if (Helper::checkRoute('/'.$actionId, Yii::$app->getRequest()->get(), $user)) {
71 71
             return true;
72 72
         }
73 73
         $this->denyAccess($user);
@@ -100,15 +100,15 @@  discard block
 block discarded – undo
100 100
         }
101 101
 
102 102
         $user = $this->getUser();
103
-        if($user->getIsGuest())
103
+        if ($user->getIsGuest())
104 104
         {
105 105
             $loginUrl = null;
106
-            if(is_array($user->loginUrl) && isset($user->loginUrl[0])){
106
+            if (is_array($user->loginUrl) && isset($user->loginUrl[0])) {
107 107
                 $loginUrl = $user->loginUrl[0];
108
-                }else if(is_string($user->loginUrl)){
108
+                } else if (is_string($user->loginUrl)) {
109 109
                     $loginUrl = $user->loginUrl;
110 110
                 }
111
-                if(!is_null($loginUrl) && trim($loginUrl,'/') === $uniqueId)
111
+                if (!is_null($loginUrl) && trim($loginUrl, '/') === $uniqueId)
112 112
                 {
113 113
                     return false;
114 114
                 }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
             // convert action uniqueId into an ID relative to the module
119 119
             $mid = $this->owner->getUniqueId();
120 120
             $id = $uniqueId;
121
-            if ($mid !== '' && strpos($id, $mid . '/') === 0) {
121
+            if ($mid !== '' && strpos($id, $mid.'/') === 0) {
122 122
                 $id = substr($id, strlen($mid) + 1);
123 123
             }
124 124
         } else {
Please login to merge, or discard this patch.
models/AuthItem.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
         return [
62 62
             [['ruleName'], 'checkRule'],
63 63
             [['name', 'type'], 'required'],
64
-            [['name'], 'unique', 'when' => function () {
64
+            [['name'], 'unique', 'when' => function() {
65 65
                 return $this->isNewRecord || ($this->_item->name != $this->name);
66 66
             }],
67 67
             [['type'], 'integer'],
Please login to merge, or discard this patch.
Module.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     public function getMenus()
119 119
     {
120 120
         if ($this->_normalizeMenus === null) {
121
-            $mid = '/' . $this->getUniqueId() . '/';
121
+            $mid = '/'.$this->getUniqueId().'/';
122 122
             // resolve core menus
123 123
             $this->_normalizeMenus = [];
124 124
 
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
             ];
131 131
             foreach ($this->_coreItems as $id => $lable) {
132 132
                 if (!isset($conditions[$id]) || $conditions[$id]) {
133
-                    $this->_normalizeMenus[$id] = ['label' => Yii::t('rbac-admin', $lable), 'url' => [$mid . $id]];
133
+                    $this->_normalizeMenus[$id] = ['label' => Yii::t('rbac-admin', $lable), 'url' => [$mid.$id]];
134 134
                 }
135 135
             }
136 136
             foreach (array_keys($this->controllerMap) as $id) {
137
-                $this->_normalizeMenus[$id] = ['label' => Yii::t('rbac-admin', Inflector::humanize($id)), 'url' => [$mid . $id]];
137
+                $this->_normalizeMenus[$id] = ['label' => Yii::t('rbac-admin', Inflector::humanize($id)), 'url' => [$mid.$id]];
138 138
             }
139 139
 
140 140
             // user configure menus
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
                 $this->_normalizeMenus[$id] = isset($this->_normalizeMenus[$id]) ? array_merge($this->_normalizeMenus[$id], $value)
150 150
                 : $value;
151 151
                 if (!isset($this->_normalizeMenus[$id]['url'])) {
152
-                    $this->_normalizeMenus[$id]['url'] = [$mid . $id];
152
+                    $this->_normalizeMenus[$id]['url'] = [$mid.$id];
153 153
                 }
154 154
             }
155 155
         }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
             $view->params['breadcrumbs'][] = [
179 179
                 'label' => ($this->defaultUrlLabel ?: Yii::t('rbac-admin', 'Admin')),
180
-                'url' => ['/' . ($this->defaultUrl ?: $this->uniqueId)],
180
+                'url' => ['/'.($this->defaultUrl ?: $this->uniqueId)],
181 181
             ];
182 182
             return true;
183 183
         }
Please login to merge, or discard this patch.
views/item/view.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
26 26
 $animateIcon = ' <i class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></i>';
27 27
 ?>
28 28
 <div class="auth-item-view">
29
-    <h1><?=Html::encode($this->title);?></h1>
29
+    <h1><?=Html::encode($this->title); ?></h1>
30 30
     <p>
31
-        <?=Html::a(Yii::t('rbac-admin', 'Update'), ['update', 'id' => $model->name], ['class' => 'btn btn-primary']);?>
31
+        <?=Html::a(Yii::t('rbac-admin', 'Update'), ['update', 'id' => $model->name], ['class' => 'btn btn-primary']); ?>
32 32
         <?=Html::a(Yii::t('rbac-admin', 'Delete'), ['delete', 'id' => $model->name], [
33 33
     'class' => 'btn btn-danger',
34 34
     'data-confirm' => Yii::t('rbac-admin', 'Are you sure to delete this item?'),
35 35
     'data-method' => 'post',
36
-]);?>
37
-        <?=Html::a(Yii::t('rbac-admin', 'Create'), ['create'], ['class' => 'btn btn-success']);?>
36
+]); ?>
37
+        <?=Html::a(Yii::t('rbac-admin', 'Create'), ['create'], ['class' => 'btn btn-success']); ?>
38 38
     </p>
39 39
     <div class="row">
40 40
         <div class="col-sm-11">
@@ -55,25 +55,25 @@  discard block
 block discarded – undo
55 55
     <div class="row">
56 56
         <div class="col-sm-5">
57 57
             <input class="form-control search" data-target="available"
58
-                   placeholder="<?=Yii::t('rbac-admin', 'Search for available');?>">
58
+                   placeholder="<?=Yii::t('rbac-admin', 'Search for available'); ?>">
59 59
             <select multiple size="20" class="form-control list" data-target="available"></select>
60 60
         </div>
61 61
         <div class="col-sm-1">
62 62
             <br><br>
63
-            <?=Html::a('&gt;&gt;' . $animateIcon, ['assign', 'id' => $model->name], [
63
+            <?=Html::a('&gt;&gt;'.$animateIcon, ['assign', 'id' => $model->name], [
64 64
     'class' => 'btn btn-success btn-assign',
65 65
     'data-target' => 'available',
66 66
     'title' => Yii::t('rbac-admin', 'Assign'),
67
-]);?><br><br>
68
-            <?=Html::a('&lt;&lt;' . $animateIcon, ['remove', 'id' => $model->name], [
67
+]); ?><br><br>
68
+            <?=Html::a('&lt;&lt;'.$animateIcon, ['remove', 'id' => $model->name], [
69 69
     'class' => 'btn btn-danger btn-assign',
70 70
     'data-target' => 'assigned',
71 71
     'title' => Yii::t('rbac-admin', 'Remove'),
72
-]);?>
72
+]); ?>
73 73
         </div>
74 74
         <div class="col-sm-5">
75 75
             <input class="form-control search" data-target="assigned"
76
-                   placeholder="<?=Yii::t('rbac-admin', 'Search for assigned');?>">
76
+                   placeholder="<?=Yii::t('rbac-admin', 'Search for assigned'); ?>">
77 77
             <select multiple size="20" class="form-control list" data-target="assigned"></select>
78 78
         </div>
79 79
     </div>
Please login to merge, or discard this patch.
views/assignment/view.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
 
13 13
 $userName = $model->{$usernameField};
14 14
 if (!empty($fullnameField)) {
15
-    $userName .= ' (' . ArrayHelper::getValue($model, $fullnameField) . ')';
15
+    $userName .= ' ('.ArrayHelper::getValue($model, $fullnameField).')';
16 16
 }
17 17
 $userName = Html::encode($userName);
18 18
 
19
-$this->title = Yii::t('rbac-admin', 'Assignment') . ' : ' . $userName;
19
+$this->title = Yii::t('rbac-admin', 'Assignment').' : '.$userName;
20 20
 
21 21
 $this->params['breadcrumbs'][] = ['label' => Yii::t('rbac-admin', 'Assignments'), 'url' => ['index']];
22 22
 $this->params['breadcrumbs'][] = $userName;
@@ -31,31 +31,31 @@  discard block
 block discarded – undo
31 31
 $animateIcon = ' <i class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></i>';
32 32
 ?>
33 33
 <div class="assignment-index">
34
-    <h1><?=$this->title;?></h1>
34
+    <h1><?=$this->title; ?></h1>
35 35
 
36 36
     <div class="row">
37 37
         <div class="col-sm-5">
38 38
             <input class="form-control search" data-target="available"
39
-                   placeholder="<?=Yii::t('rbac-admin', 'Search for available');?>">
39
+                   placeholder="<?=Yii::t('rbac-admin', 'Search for available'); ?>">
40 40
             <select multiple size="20" class="form-control list" data-target="available">
41 41
             </select>
42 42
         </div>
43 43
         <div class="col-sm-1">
44 44
             <br><br>
45
-            <?=Html::a('&gt;&gt;' . $animateIcon, ['assign', 'id' => (string) $model->id], [
45
+            <?=Html::a('&gt;&gt;'.$animateIcon, ['assign', 'id' => (string)$model->id], [
46 46
     'class' => 'btn btn-success btn-assign',
47 47
     'data-target' => 'available',
48 48
     'title' => Yii::t('rbac-admin', 'Assign'),
49
-]);?><br><br>
50
-            <?=Html::a('&lt;&lt;' . $animateIcon, ['revoke', 'id' => (string) $model->id], [
49
+]); ?><br><br>
50
+            <?=Html::a('&lt;&lt;'.$animateIcon, ['revoke', 'id' => (string)$model->id], [
51 51
     'class' => 'btn btn-danger btn-assign',
52 52
     'data-target' => 'assigned',
53 53
     'title' => Yii::t('rbac-admin', 'Remove'),
54
-]);?>
54
+]); ?>
55 55
         </div>
56 56
         <div class="col-sm-5">
57 57
             <input class="form-control search" data-target="assigned"
58
-                   placeholder="<?=Yii::t('rbac-admin', 'Search for assigned');?>">
58
+                   placeholder="<?=Yii::t('rbac-admin', 'Search for assigned'); ?>">
59 59
             <select multiple size="20" class="form-control list" data-target="assigned">
60 60
             </select>
61 61
         </div>
Please login to merge, or discard this patch.
views/route/index.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,17 +20,17 @@  discard block
 block discarded – undo
20 20
 $this->registerJs($this->render('_script.js'));
21 21
 $animateIcon = ' <i class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></i>';
22 22
 ?>
23
-<h1><?=Html::encode($this->title);?></h1>
23
+<h1><?=Html::encode($this->title); ?></h1>
24 24
 <div class="row">
25 25
     <div class="col-sm-11">
26 26
         <div class="input-group">
27 27
             <input id="inp-route" type="text" class="form-control"
28
-                   placeholder="<?=Yii::t('rbac-admin', 'New route(s)');?>">
28
+                   placeholder="<?=Yii::t('rbac-admin', 'New route(s)'); ?>">
29 29
             <span class="input-group-btn">
30
-                <?=Html::a(Yii::t('rbac-admin', 'Add') . $animateIcon, ['create'], [
30
+                <?=Html::a(Yii::t('rbac-admin', 'Add').$animateIcon, ['create'], [
31 31
     'class' => 'btn btn-success',
32 32
     'id' => 'btn-new',
33
-]);?>
33
+]); ?>
34 34
             </span>
35 35
         </div>
36 36
     </div>
@@ -40,32 +40,32 @@  discard block
 block discarded – undo
40 40
     <div class="col-sm-5">
41 41
         <div class="input-group">
42 42
             <input class="form-control search" data-target="available"
43
-                   placeholder="<?=Yii::t('rbac-admin', 'Search for available');?>">
43
+                   placeholder="<?=Yii::t('rbac-admin', 'Search for available'); ?>">
44 44
             <span class="input-group-btn">
45 45
                 <?=Html::a('<span class="glyphicon glyphicon-refresh"></span>', ['refresh'], [
46 46
     'class' => 'btn btn-default',
47 47
     'id' => 'btn-refresh',
48
-]);?>
48
+]); ?>
49 49
             </span>
50 50
         </div>
51 51
         <select multiple size="20" class="form-control list" data-target="available"></select>
52 52
     </div>
53 53
     <div class="col-sm-1">
54 54
         <br><br>
55
-        <?=Html::a('&gt;&gt;' . $animateIcon, ['assign'], [
55
+        <?=Html::a('&gt;&gt;'.$animateIcon, ['assign'], [
56 56
     'class' => 'btn btn-success btn-assign',
57 57
     'data-target' => 'available',
58 58
     'title' => Yii::t('rbac-admin', 'Assign'),
59
-]);?><br><br>
60
-        <?=Html::a('&lt;&lt;' . $animateIcon, ['remove'], [
59
+]); ?><br><br>
60
+        <?=Html::a('&lt;&lt;'.$animateIcon, ['remove'], [
61 61
     'class' => 'btn btn-danger btn-assign',
62 62
     'data-target' => 'assigned',
63 63
     'title' => Yii::t('rbac-admin', 'Remove'),
64
-]);?>
64
+]); ?>
65 65
     </div>
66 66
     <div class="col-sm-5">
67 67
         <input class="form-control search" data-target="assigned"
68
-               placeholder="<?=Yii::t('rbac-admin', 'Search for assigned');?>">
68
+               placeholder="<?=Yii::t('rbac-admin', 'Search for assigned'); ?>">
69 69
         <select multiple size="20" class="form-control list" data-target="assigned"></select>
70 70
     </div>
71 71
 </div>
Please login to merge, or discard this patch.
models/Route.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
         foreach ($routes as $route) {
32 32
             try {
33 33
                 $r = explode('&', $route);
34
-                $item = $manager->createPermission('/' . trim($route, '/'));
34
+                $item = $manager->createPermission('/'.trim($route, '/'));
35 35
                 if (count($r) > 1) {
36
-                    $action = '/' . trim($r[0], '/');
36
+                    $action = '/'.trim($r[0], '/');
37 37
                     if (($itemAction = $manager->getPermission($action)) === null) {
38 38
                         $itemAction = $manager->createPermission($action);
39 39
                         $manager->add($itemAction);
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $manager = Configs::authManager();
68 68
         foreach ($routes as $route) {
69 69
             try {
70
-                $item = $manager->createPermission('/' . trim($route, '/'));
70
+                $item = $manager->createPermission('/'.trim($route, '/'));
71 71
                 $manager->remove($item);
72 72
             } catch (Exception $exc) {
73 73
                 Yii::error($exc->getMessage(), __METHOD__);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      */
132 132
     protected function getRouteRecursive($module, &$result)
133 133
     {
134
-        $token = "Get Route of '" . get_class($module) . "' with id '" . $module->uniqueId . "'";
134
+        $token = "Get Route of '".get_class($module)."' with id '".$module->uniqueId."'";
135 135
         Yii::beginProfile($token, __METHOD__);
136 136
         try {
137 137
             foreach ($module->getModules() as $id => $child) {
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
                 $this->getControllerActions($type, $id, $module, $result);
145 145
             }
146 146
 
147
-            $namespace = trim($module->controllerNamespace, '\\') . '\\';
147
+            $namespace = trim($module->controllerNamespace, '\\').'\\';
148 148
             $this->getControllerFiles($module, $namespace, '', $result);
149
-            $all = '/' . ltrim($module->uniqueId . '/*', '/');
149
+            $all = '/'.ltrim($module->uniqueId.'/*', '/');
150 150
             $result[$all] = $all;
151 151
         } catch (\Exception $exc) {
152 152
             Yii::error($exc->getMessage(), __METHOD__);
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
      */
165 165
     protected function getControllerFiles($module, $namespace, $prefix, &$result)
166 166
     {
167
-        $path = Yii::getAlias('@' . str_replace('\\', '/', $namespace), false);
167
+        $path = Yii::getAlias('@'.str_replace('\\', '/', $namespace), false);
168 168
         $token = "Get controllers from '$path'";
169 169
         Yii::beginProfile($token, __METHOD__);
170 170
         try {
@@ -175,15 +175,15 @@  discard block
 block discarded – undo
175 175
                 if ($file == '.' || $file == '..') {
176 176
                     continue;
177 177
                 }
178
-                if (is_dir($path . '/' . $file) && preg_match('%^[a-z0-9_/]+$%i', $file . '/')) {
179
-                    $this->getControllerFiles($module, $namespace . $file . '\\', $prefix . $file . '/', $result);
178
+                if (is_dir($path.'/'.$file) && preg_match('%^[a-z0-9_/]+$%i', $file.'/')) {
179
+                    $this->getControllerFiles($module, $namespace.$file.'\\', $prefix.$file.'/', $result);
180 180
                 } elseif (strcmp(substr($file, -14), 'Controller.php') === 0) {
181 181
                     $baseName = substr(basename($file), 0, -14);
182 182
                     $name = strtolower(preg_replace('/(?<![A-Z])[A-Z]/', ' \0', $baseName));
183 183
                     $id = ltrim(str_replace(' ', '-', $name), '-');
184
-                    $className = $namespace . $baseName . 'Controller';
184
+                    $className = $namespace.$baseName.'Controller';
185 185
                     if (strpos($className, '-') === false && class_exists($className) && is_subclass_of($className, 'yii\base\Controller')) {
186
-                        $this->getControllerActions($className, $prefix . $id, $module, $result);
186
+                        $this->getControllerActions($className, $prefix.$id, $module, $result);
187 187
                     }
188 188
                 }
189 189
             }
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
      */
203 203
     protected function getControllerActions($type, $id, $module, &$result)
204 204
     {
205
-        $token = "Create controller with cofig=" . VarDumper::dumpAsString($type) . " and id='$id'";
205
+        $token = "Create controller with cofig=".VarDumper::dumpAsString($type)." and id='$id'";
206 206
         Yii::beginProfile($token, __METHOD__);
207 207
         try {
208 208
             /* @var $controller \yii\base\Controller */
@@ -223,19 +223,19 @@  discard block
 block discarded – undo
223 223
      */
224 224
     protected function getActionRoutes($controller, &$result)
225 225
     {
226
-        $token = "Get actions of controller '" . $controller->uniqueId . "'";
226
+        $token = "Get actions of controller '".$controller->uniqueId."'";
227 227
         Yii::beginProfile($token, __METHOD__);
228 228
         try {
229
-            $prefix = '/' . $controller->uniqueId . '/';
229
+            $prefix = '/'.$controller->uniqueId.'/';
230 230
             foreach ($controller->actions() as $id => $value) {
231
-                $result[$prefix . $id] = $prefix . $id;
231
+                $result[$prefix.$id] = $prefix.$id;
232 232
             }
233 233
             $class = new \ReflectionClass($controller);
234 234
             foreach ($class->getMethods() as $method) {
235 235
                 $name = $method->getName();
236 236
                 if ($method->isPublic() && !$method->isStatic() && strpos($name, 'action') === 0 && $name !== 'actions') {
237 237
                     $name = strtolower(preg_replace('/(?<![A-Z])[A-Z]/', ' \0', substr($name, 6)));
238
-                    $id = $prefix . ltrim(str_replace(' ', '-', $name), '-');
238
+                    $id = $prefix.ltrim(str_replace(' ', '-', $name), '-');
239 239
                     $result[$id] = $id;
240 240
                 }
241 241
             }
Please login to merge, or discard this patch.