@@ -4,7 +4,7 @@ |
||
| 4 | 4 | /* @var $this yii\web\View */ |
| 5 | 5 | /* @var $user mdm\admin\models\User */ |
| 6 | 6 | |
| 7 | -$resetLink = Url::to(['user/reset-password','token'=>$user->password_reset_token], true); |
|
| 7 | +$resetLink = Url::to(['user/reset-password', 'token'=>$user->password_reset_token], true); |
|
| 8 | 8 | ?> |
| 9 | 9 | Hello <?= $user->username ?>, |
| 10 | 10 | |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | parent::init(); |
| 33 | 33 | if ($this->userClassName === null) { |
| 34 | 34 | $this->userClassName = Yii::$app->getUser()->identityClass; |
| 35 | - $this->userClassName = $this->userClassName ? : 'mdm\admin\models\User'; |
|
| 35 | + $this->userClassName = $this->userClassName ?: 'mdm\admin\models\User'; |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | return $this->redirect(['view', 'id' => $model->name]); |
| 76 | 76 | } else { |
| 77 | - return $this->render('create', ['model' => $model,]); |
|
| 77 | + return $this->render('create', ['model' => $model, ]); |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | return $this->redirect(['view', 'id' => $model->name]); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - return $this->render('update', ['model' => $model,]); |
|
| 96 | + return $this->render('update', ['model' => $model, ]); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | 'attribute' => 'description', |
| 42 | 42 | 'label' => Yii::t('rbac-admin', 'Description'), |
| 43 | 43 | ], |
| 44 | - ['class' => 'yii\grid\ActionColumn',], |
|
| 44 | + ['class' => 'yii\grid\ActionColumn', ], |
|
| 45 | 45 | ], |
| 46 | 46 | ]) |
| 47 | 47 | ?> |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | /* @var $this yii\web\View */ |
| 5 | 5 | /* @var $user mdm\admin\models\User */ |
| 6 | 6 | |
| 7 | -$resetLink = Url::to(['user/reset-password','token'=>$user->password_reset_token], true); |
|
| 7 | +$resetLink = Url::to(['user/reset-password', 'token'=>$user->password_reset_token], true); |
|
| 8 | 8 | ?> |
| 9 | 9 | Hello <?= $user->username ?>, |
| 10 | 10 | |
@@ -49,9 +49,9 @@ |
||
| 49 | 49 | |
| 50 | 50 | if ($user->save()) { |
| 51 | 51 | return Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user]) |
| 52 | - ->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot']) |
|
| 52 | + ->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name.' robot']) |
|
| 53 | 53 | ->setTo($this->email) |
| 54 | - ->setSubject('Password reset for ' . Yii::$app->name) |
|
| 54 | + ->setSubject('Password reset for '.Yii::$app->name) |
|
| 55 | 55 | ->send(); |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | $expire = Yii::$app->params['user.passwordResetTokenExpire']; |
| 119 | 119 | $parts = explode('_', $token); |
| 120 | - $timestamp = (int) end($parts); |
|
| 120 | + $timestamp = (int)end($parts); |
|
| 121 | 121 | return $timestamp + $expire >= time(); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public function generatePasswordResetToken() |
| 181 | 181 | { |
| 182 | - $this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time(); |
|
| 182 | + $this->password_reset_token = Yii::$app->security->generateRandomString().'_'.time(); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -44,9 +44,9 @@ |
||
| 44 | 44 | public function search($params) |
| 45 | 45 | { |
| 46 | 46 | $query = MenuModel::find() |
| 47 | - ->from(MenuModel::tableName() . ' t') |
|
| 48 | - ->joinWith(['menuParent' => function ($q) { |
|
| 49 | - $q->from(MenuModel::tableName() . ' parent'); |
|
| 47 | + ->from(MenuModel::tableName().' t') |
|
| 48 | + ->joinWith(['menuParent' => function($q) { |
|
| 49 | + $q->from(MenuModel::tableName().' parent'); |
|
| 50 | 50 | }]); |
| 51 | 51 | |
| 52 | 52 | $dataProvider = new ActiveDataProvider([ |
@@ -31,9 +31,9 @@ discard block |
||
| 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 |
||
| 67 | 67 | $manager = Yii::$app->getAuthManager(); |
| 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 |
||
| 131 | 131 | */ |
| 132 | 132 | protected function getRouteRecrusive($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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |