@@ -186,7 +186,7 @@ |
||
| 186 | 186 | * Normalize menu |
| 187 | 187 | * @param array $assigned |
| 188 | 188 | * @param array $menus |
| 189 | - * @param Closure $callback |
|
| 189 | + * @param \Closure|null $callback |
|
| 190 | 190 | * @param integer $parent |
| 191 | 191 | * @return array |
| 192 | 192 | */ |
@@ -101,7 +101,7 @@ |
||
| 101 | 101 | if (strpos($route, $prefix) !== 0) { |
| 102 | 102 | if (substr($route, -1) === '/') { |
| 103 | 103 | $prefix = $route; |
| 104 | - $filter1[] = $route . '%'; |
|
| 104 | + $filter1[] = $route.'%'; |
|
| 105 | 105 | } else { |
| 106 | 106 | $filter2[] = $route; |
| 107 | 107 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * Lists all Assignment models. |
| 58 | - * @return mixed |
|
| 58 | + * @return string |
|
| 59 | 59 | */ |
| 60 | 60 | public function actionIndex() |
| 61 | 61 | { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | /** |
| 82 | 82 | * Displays a single Assignment model. |
| 83 | 83 | * @param integer $id |
| 84 | - * @return mixed |
|
| 84 | + * @return string |
|
| 85 | 85 | */ |
| 86 | 86 | public function actionView($id) |
| 87 | 87 | { |
@@ -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 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * Lists all Menu models. |
| 39 | - * @return mixed |
|
| 39 | + * @return string |
|
| 40 | 40 | */ |
| 41 | 41 | public function actionIndex() |
| 42 | 42 | { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * Displays a single Menu model. |
| 54 | 54 | * @param integer $id |
| 55 | - * @return mixed |
|
| 55 | + * @return string |
|
| 56 | 56 | */ |
| 57 | 57 | public function actionView($id) |
| 58 | 58 | { |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * Deletes an existing Menu model. |
| 107 | 107 | * If deletion is successful, the browser will be redirected to the 'index' page. |
| 108 | 108 | * @param integer $id |
| 109 | - * @return mixed |
|
| 109 | + * @return \yii\web\Response |
|
| 110 | 110 | */ |
| 111 | 111 | public function actionDelete($id) |
| 112 | 112 | { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * Lists all AuthItem models. |
| 39 | - * @return mixed |
|
| 39 | + * @return string |
|
| 40 | 40 | */ |
| 41 | 41 | public function actionIndex() |
| 42 | 42 | { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * Displays a single AuthItem model. |
| 54 | 54 | * @param string $id |
| 55 | - * @return mixed |
|
| 55 | + * @return string |
|
| 56 | 56 | */ |
| 57 | 57 | public function actionView($id) |
| 58 | 58 | { |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * Deletes an existing AuthItem model. |
| 101 | 101 | * If deletion is successful, the browser will be redirected to the 'index' page. |
| 102 | 102 | * @param string $id |
| 103 | - * @return mixed |
|
| 103 | + * @return \yii\web\Response |
|
| 104 | 104 | */ |
| 105 | 105 | public function actionDelete($id) |
| 106 | 106 | { |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * Finds the AuthItem model based on its primary key value. |
| 116 | 116 | * If the model is not found, a 404 HTTP exception will be thrown. |
| 117 | 117 | * @param string $id |
| 118 | - * @return AuthItem the loaded model |
|
| 118 | + * @return BizRule the loaded model |
|
| 119 | 119 | * @throws HttpException if the model cannot be found |
| 120 | 120 | */ |
| 121 | 121 | protected function findModel($id) |
@@ -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 | /** |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | 89 | * Lists all User models. |
| 90 | - * @return mixed |
|
| 90 | + * @return string |
|
| 91 | 91 | */ |
| 92 | 92 | public function actionIndex() |
| 93 | 93 | { |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | /** |
| 104 | 104 | * Displays a single User model. |
| 105 | 105 | * @param integer $id |
| 106 | - * @return mixed |
|
| 106 | + * @return string |
|
| 107 | 107 | */ |
| 108 | 108 | public function actionView($id) |
| 109 | 109 | { |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * Deletes an existing User model. |
| 117 | 117 | * If deletion is successful, the browser will be redirected to the 'index' page. |
| 118 | 118 | * @param integer $id |
| 119 | - * @return mixed |
|
| 119 | + * @return \yii\web\Response |
|
| 120 | 120 | */ |
| 121 | 121 | public function actionDelete($id) |
| 122 | 122 | { |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | /** |
| 149 | 149 | * Logout |
| 150 | - * @return string |
|
| 150 | + * @return \yii\web\Response |
|
| 151 | 151 | */ |
| 152 | 152 | public function actionLogout() |
| 153 | 153 | { |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | /** |
| 239 | 239 | * Activate new user |
| 240 | 240 | * @param integer $id |
| 241 | - * @return type |
|
| 241 | + * @return \yii\web\Response |
|
| 242 | 242 | * @throws UserException |
| 243 | 243 | * @throws NotFoundHttpException |
| 244 | 244 | */ |
@@ -14,7 +14,6 @@ |
||
| 14 | 14 | use yii\web\BadRequestHttpException; |
| 15 | 15 | use yii\web\Controller; |
| 16 | 16 | use yii\filters\VerbFilter; |
| 17 | -use yii\filters\AccessControl; |
|
| 18 | 17 | use yii\web\NotFoundHttpException; |
| 19 | 18 | use yii\base\UserException; |
| 20 | 19 | use yii\mail\BaseMailer; |
@@ -149,7 +149,7 @@ |
||
| 149 | 149 | |
| 150 | 150 | /** |
| 151 | 151 | * Get item |
| 152 | - * @return Item |
|
| 152 | + * @return Rule |
|
| 153 | 153 | */ |
| 154 | 154 | public function getItem() |
| 155 | 155 | { |
@@ -219,7 +219,7 @@ |
||
| 219 | 219 | /** |
| 220 | 220 | * Get route of action |
| 221 | 221 | * @param \yii\base\Controller $controller |
| 222 | - * @param array $result all controller action. |
|
| 222 | + * @param string $result all controller action. |
|
| 223 | 223 | */ |
| 224 | 224 | protected function getActionRoutes($controller, &$result) |
| 225 | 225 | { |
@@ -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 | } |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace mdm\admin\models\searchs; |
| 4 | 4 | |
| 5 | -use Yii; |
|
| 6 | 5 | use yii\base\Model; |
| 7 | 6 | use yii\data\ActiveDataProvider; |
| 8 | 7 | use mdm\admin\models\Menu as MenuModel; |
@@ -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([ |
@@ -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 | |