Completed
Pull Request — master (#400)
by
unknown
02:30
created
models/Route.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
                 $r = explode('&', $route);
39 39
                 $item = $manager->createPermission($this->getPermissionName($route));
40 40
                 if (count($r) > 1) {
41
-                    $action = '/' . trim($r[0], '/');
41
+                    $action = '/'.trim($r[0], '/');
42 42
                     if (($itemAction = $manager->getPermission($action)) === null) {
43 43
                         $itemAction = $manager->createPermission($action);
44 44
                         $manager->add($itemAction);
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
     public function getPermissionName($route)
102 102
     {
103 103
         if (self::PREFIX_BASIC == $this->routePrefix) {
104
-            return self::PREFIX_BASIC . trim($route, self::PREFIX_BASIC);
104
+            return self::PREFIX_BASIC.trim($route, self::PREFIX_BASIC);
105 105
         } else {
106
-            return self::PREFIX_ADVANCED . ltrim(trim($route, self::PREFIX_BASIC), self::PREFIX_ADVANCED);
106
+            return self::PREFIX_ADVANCED.ltrim(trim($route, self::PREFIX_BASIC), self::PREFIX_ADVANCED);
107 107
         }
108 108
     }
109 109
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             // Step through each configured application
128 128
             foreach ($advanced as $id => $configPaths) {
129 129
                 // Force correct id string.
130
-                $id = $this->routePrefix . ltrim(trim($id), $this->routePrefix);
130
+                $id = $this->routePrefix.ltrim(trim($id), $this->routePrefix);
131 131
                 // Create empty config array.
132 132
                 $config = [];
133 133
                 // Assemble configuration for current app.
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
                 unset($app);
145 145
                 // Prepend the app id to all routes.
146 146
                 foreach ($r as $route) {
147
-                    $routes[$id . $route] = $id . $route;
147
+                    $routes[$id.$route] = $id.$route;
148 148
                 }
149 149
             }
150 150
             // Switch back to original app.
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      */
205 205
     protected function getRouteRecursive($module, &$result)
206 206
     {
207
-        $token = "Get Route of '" . get_class($module) . "' with id '" . $module->uniqueId . "'";
207
+        $token = "Get Route of '".get_class($module)."' with id '".$module->uniqueId."'";
208 208
         Yii::beginProfile($token, __METHOD__);
209 209
         try {
210 210
             foreach ($module->getModules() as $id => $child) {
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
                 $this->getControllerActions($type, $id, $module, $result);
218 218
             }
219 219
 
220
-            $namespace = trim($module->controllerNamespace, '\\') . '\\';
220
+            $namespace = trim($module->controllerNamespace, '\\').'\\';
221 221
             $this->getControllerFiles($module, $namespace, '', $result);
222
-            $all = '/' . ltrim($module->uniqueId . '/*', '/');
222
+            $all = '/'.ltrim($module->uniqueId.'/*', '/');
223 223
             $result[$all] = $all;
224 224
         } catch (\Exception $exc) {
225 225
             Yii::error($exc->getMessage(), __METHOD__);
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
      */
238 238
     protected function getControllerFiles($module, $namespace, $prefix, &$result)
239 239
     {
240
-        $path = Yii::getAlias('@' . str_replace('\\', '/', $namespace), false);
240
+        $path = Yii::getAlias('@'.str_replace('\\', '/', $namespace), false);
241 241
         $token = "Get controllers from '$path'";
242 242
         Yii::beginProfile($token, __METHOD__);
243 243
         try {
@@ -248,15 +248,15 @@  discard block
 block discarded – undo
248 248
                 if ($file == '.' || $file == '..') {
249 249
                     continue;
250 250
                 }
251
-                if (is_dir($path . '/' . $file) && preg_match('%^[a-z0-9_/]+$%i', $file . '/')) {
252
-                    $this->getControllerFiles($module, $namespace . $file . '\\', $prefix . $file . '/', $result);
251
+                if (is_dir($path.'/'.$file) && preg_match('%^[a-z0-9_/]+$%i', $file.'/')) {
252
+                    $this->getControllerFiles($module, $namespace.$file.'\\', $prefix.$file.'/', $result);
253 253
                 } elseif (strcmp(substr($file, -14), 'Controller.php') === 0) {
254 254
                     $baseName = substr(basename($file), 0, -14);
255 255
                     $name = strtolower(preg_replace('/(?<![A-Z])[A-Z]/', ' \0', $baseName));
256 256
                     $id = ltrim(str_replace(' ', '-', $name), '-');
257
-                    $className = $namespace . $baseName . 'Controller';
257
+                    $className = $namespace.$baseName.'Controller';
258 258
                     if (strpos($className, '-') === false && class_exists($className) && is_subclass_of($className, 'yii\base\Controller')) {
259
-                        $this->getControllerActions($className, $prefix . $id, $module, $result);
259
+                        $this->getControllerActions($className, $prefix.$id, $module, $result);
260 260
                     }
261 261
                 }
262 262
             }
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
      */
276 276
     protected function getControllerActions($type, $id, $module, &$result)
277 277
     {
278
-        $token = "Create controller with cofig=" . VarDumper::dumpAsString($type) . " and id='$id'";
278
+        $token = "Create controller with cofig=".VarDumper::dumpAsString($type)." and id='$id'";
279 279
         Yii::beginProfile($token, __METHOD__);
280 280
         try {
281 281
             /* @var $controller \yii\base\Controller */
@@ -296,19 +296,19 @@  discard block
 block discarded – undo
296 296
      */
297 297
     protected function getActionRoutes($controller, &$result)
298 298
     {
299
-        $token = "Get actions of controller '" . $controller->uniqueId . "'";
299
+        $token = "Get actions of controller '".$controller->uniqueId."'";
300 300
         Yii::beginProfile($token, __METHOD__);
301 301
         try {
302
-            $prefix = '/' . $controller->uniqueId . '/';
302
+            $prefix = '/'.$controller->uniqueId.'/';
303 303
             foreach ($controller->actions() as $id => $value) {
304
-                $result[$prefix . $id] = $prefix . $id;
304
+                $result[$prefix.$id] = $prefix.$id;
305 305
             }
306 306
             $class = new \ReflectionClass($controller);
307 307
             foreach ($class->getMethods() as $method) {
308 308
                 $name = $method->getName();
309 309
                 if ($method->isPublic() && !$method->isStatic() && strpos($name, 'action') === 0 && $name !== 'actions') {
310 310
                     $name = strtolower(preg_replace('/(?<![A-Z])[A-Z]/', ' \0', substr($name, 6)));
311
-                    $id = $prefix . ltrim(str_replace(' ', '-', $name), '-');
311
+                    $id = $prefix.ltrim(str_replace(' ', '-', $name), '-');
312 312
                     $result[$id] = $id;
313 313
                 }
314 314
             }
Please login to merge, or discard this patch.
views/default/index.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
     $baseDir = '';
11 11
     $this->title = substr($page, 0, strrpos($page, '.'));
12 12
 } else {
13
-    $baseDir = substr($page, 0, $pos) . '/';
13
+    $baseDir = substr($page, 0, $pos).'/';
14 14
     $this->title = substr($page, $pos + 1, strrpos($page, '.') - $pos - 1);
15 15
 }
16 16
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $url = Url::to($menu['url'], true);
23 23
         $links[] = "[**{$menu['label']}**]({$url})";
24 24
     }
25
-    $body = str_replace(':smile:.', ".\n\n" . implode('  ', $links) . "\n", file_get_contents(Url::to('@mdm/admin/README.md')));
25
+    $body = str_replace(':smile:.', ".\n\n".implode('  ', $links)."\n", file_get_contents(Url::to('@mdm/admin/README.md')));
26 26
 } else {
27 27
     $body = file_get_contents(Url::to("@mdm/admin/{$page}"));
28 28
 }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         if ($link[0] == '/') {
34 34
             $link = Url::current(['page' => ltrim($link, '/')], true);
35 35
         } else {
36
-            $link = Url::current(['page' => $baseDir . $link], true);
36
+            $link = Url::current(['page' => $baseDir.$link], true);
37 37
         }
38 38
     }
39 39
     return "]($link)";
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'], 'checkUnique', 'when' => function () {
64
+            [['name'], 'checkUnique', '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.
BaseObject.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 namespace mdm\admin;
4 4
 
5
-if(!class_exists('yii\base\BaseObject')){
5
+if (!class_exists('yii\base\BaseObject')) {
6 6
     class_alias('yii\base\Object', 'yii\base\BaseObject');
7 7
 }
8 8
 
Please login to merge, or discard this patch.
components/AccessControl.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
         $user = $this->getUser();
70 70
 
71 71
         $request = Yii::$app->getRequest();
72
-        if($request->getIsPost()){
72
+        if ($request->getIsPost()) {
73 73
             $params = $request->post();
74
-        }else{
74
+        } else {
75 75
             $params = $request->get();
76 76
         }
77 77
 
78
-        if (Helper::checkRoute('/' . $actionId, $params, $user)) {
78
+        if (Helper::checkRoute('/'.$actionId, $params, $user)) {
79 79
             return true;
80 80
         }
81 81
         $this->denyAccess($user);
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
         }
109 109
 
110 110
         $user = $this->getUser();
111
-        if($user->getIsGuest())
111
+        if ($user->getIsGuest())
112 112
         {
113 113
             $loginUrl = null;
114
-            if(is_array($user->loginUrl) && isset($user->loginUrl[0])){
114
+            if (is_array($user->loginUrl) && isset($user->loginUrl[0])) {
115 115
                 $loginUrl = $user->loginUrl[0];
116
-                }else if(is_string($user->loginUrl)){
116
+                } else if (is_string($user->loginUrl)) {
117 117
                     $loginUrl = $user->loginUrl;
118 118
                 }
119
-                if(!is_null($loginUrl) && trim($loginUrl,'/') === $uniqueId)
119
+                if (!is_null($loginUrl) && trim($loginUrl, '/') === $uniqueId)
120 120
                 {
121 121
                     return false;
122 122
                 }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
             // convert action uniqueId into an ID relative to the module
127 127
             $mid = $this->owner->getUniqueId();
128 128
             $id = $uniqueId;
129
-            if ($mid !== '' && strpos($id, $mid . '/') === 0) {
129
+            if ($mid !== '' && strpos($id, $mid.'/') === 0) {
130 130
                 $id = substr($id, strlen($mid) + 1);
131 131
             }
132 132
         } else {
Please login to merge, or discard this patch.
models/form/Login.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
     public function getUser()
72 72
     {
73 73
         if ($this->_user === false) {
74
-            $class = Yii::$app->getUser()->identityClass ? : 'mdm\admin\models\User';
74
+            $class = Yii::$app->getUser()->identityClass ?: 'mdm\admin\models\User';
75 75
             $this->_user = $class::findByUsername($this->username);
76 76
         }
77 77
 
Please login to merge, or discard this patch.
models/form/ResetPassword.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
         }
87 87
         $expire = ArrayHelper::getValue(Yii::$app->params, 'user.passwordResetTokenExpire', 24 * 3600);
88 88
         $parts = explode('_', $token);
89
-        $timestamp = (int) end($parts);
89
+        $timestamp = (int)end($parts);
90 90
         return $timestamp + $expire >= time();
91 91
     }
92 92
 }
Please login to merge, or discard this patch.
models/form/Signup.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function rules()
24 24
     {
25
-        $class = Yii::$app->getUser()->identityClass ? : 'mdm\admin\models\User';
25
+        $class = Yii::$app->getUser()->identityClass ?: 'mdm\admin\models\User';
26 26
         return [
27 27
             ['username', 'filter', 'filter' => 'trim'],
28 28
             ['username', 'required'],
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     public function signup()
51 51
     {
52 52
         if ($this->validate()) {
53
-            $class = Yii::$app->getUser()->identityClass ? : 'mdm\admin\models\User';
53
+            $class = Yii::$app->getUser()->identityClass ?: 'mdm\admin\models\User';
54 54
             $user = new $class();
55 55
             $user->username = $this->username;
56 56
             $user->email = $this->email;
Please login to merge, or discard this patch.
models/form/PasswordResetRequest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
      */
19 19
     public function rules()
20 20
     {
21
-        $class = Yii::$app->getUser()->identityClass ? : 'mdm\admin\models\User';
21
+        $class = Yii::$app->getUser()->identityClass ?: 'mdm\admin\models\User';
22 22
         return [
23 23
             ['email', 'filter', 'filter' => 'trim'],
24 24
             ['email', 'required'],
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     public function sendEmail()
40 40
     {
41 41
         /* @var $user User */
42
-        $class = Yii::$app->getUser()->identityClass ? : 'mdm\admin\models\User';
42
+        $class = Yii::$app->getUser()->identityClass ?: 'mdm\admin\models\User';
43 43
         $user = $class::findOne([
44 44
             'status' => UserStatus::ACTIVE,
45 45
             'email' => $this->email,
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
 
48 48
         if ($user) {
49 49
             if (!ResetPassword::isPasswordResetTokenValid($user->password_reset_token)) {
50
-                $user->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time();
50
+                $user->password_reset_token = Yii::$app->security->generateRandomString().'_'.time();
51 51
             }
52 52
 
53 53
             if ($user->save()) {
54 54
                 return Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user])
55
-                    ->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot'])
55
+                    ->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name.' robot'])
56 56
                     ->setTo($this->email)
57
-                    ->setSubject('Password reset for ' . Yii::$app->name)
57
+                    ->setSubject('Password reset for '.Yii::$app->name)
58 58
                     ->send();
59 59
             }
60 60
         }
Please login to merge, or discard this patch.