@@ -115,7 +115,7 @@ |
||
| 115 | 115 | * |
| 116 | 116 | * @param int $id |
| 117 | 117 | * |
| 118 | - * @return mixed |
|
| 118 | + * @return string |
|
| 119 | 119 | */ |
| 120 | 120 | public function actionView(int $id) |
| 121 | 121 | { |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | /** |
| 48 | 48 | * List of all rules |
| 49 | 49 | * |
| 50 | - * @return mixed |
|
| 50 | + * @return string |
|
| 51 | 51 | */ |
| 52 | 52 | public function actionIndex() |
| 53 | 53 | { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @param int $id |
| 67 | 67 | * |
| 68 | - * @return mixed |
|
| 68 | + * @return string |
|
| 69 | 69 | */ |
| 70 | 70 | public function actionView(int $id) |
| 71 | 71 | { |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * |
| 124 | 124 | * @param int $id |
| 125 | 125 | * |
| 126 | - * @return mixed |
|
| 126 | + * @return \yii\web\Response |
|
| 127 | 127 | */ |
| 128 | 128 | public function actionDelete(int $id) |
| 129 | 129 | { |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | public function addNew(array $routes): bool |
| 65 | 65 | { |
| 66 | 66 | foreach ($routes as $route) { |
| 67 | - $this->manager->add($this->manager->createPermission('/' . trim($route, ' /'))); |
|
| 67 | + $this->manager->add($this->manager->createPermission('/'.trim($route, ' /'))); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | $this->invalidate(); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | public function remove(array $routes): bool |
| 83 | 83 | { |
| 84 | 84 | foreach ($routes as $route) { |
| 85 | - $item = $this->manager->createPermission('/' . trim($route, '/')); |
|
| 85 | + $item = $this->manager->createPermission('/'.trim($route, '/')); |
|
| 86 | 86 | $this->manager->remove($item); |
| 87 | 87 | } |
| 88 | 88 | $this->invalidate(); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | protected function getRouteRecursive(Module $module, &$result): void |
| 165 | 165 | { |
| 166 | 166 | if (!in_array($module->id, $this->excludeModules)) { |
| 167 | - $token = "Get Route of '" . get_class($module) . "' with id '" . $module->uniqueId . "'"; |
|
| 167 | + $token = "Get Route of '".get_class($module)."' with id '".$module->uniqueId."'"; |
|
| 168 | 168 | Yii::beginProfile($token, __METHOD__); |
| 169 | 169 | |
| 170 | 170 | try { |
@@ -178,9 +178,9 @@ discard block |
||
| 178 | 178 | $this->getControllerActions($type, $id, $module, $result); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - $namespace = trim($module->controllerNamespace, '\\') . '\\'; |
|
| 181 | + $namespace = trim($module->controllerNamespace, '\\').'\\'; |
|
| 182 | 182 | $this->getControllerFiles($module, $namespace, '', $result); |
| 183 | - $all = '/' . ltrim($module->uniqueId . '/*', '/'); |
|
| 183 | + $all = '/'.ltrim($module->uniqueId.'/*', '/'); |
|
| 184 | 184 | $result[$all] = $all; |
| 185 | 185 | } catch (\Exception $exc) { |
| 186 | 186 | Yii::error($exc->getMessage(), __METHOD__); |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | protected function getControllerFiles(Module $module, string $namespace, string $prefix, &$result): void |
| 202 | 202 | { |
| 203 | - $path = Yii::getAlias('@' . str_replace('\\', '/', $namespace), false); |
|
| 203 | + $path = Yii::getAlias('@'.str_replace('\\', '/', $namespace), false); |
|
| 204 | 204 | $token = "Get controllers from '$path'"; |
| 205 | 205 | Yii::beginProfile($token, __METHOD__); |
| 206 | 206 | |
@@ -213,15 +213,15 @@ discard block |
||
| 213 | 213 | if ($file == '.' || $file == '..') { |
| 214 | 214 | continue; |
| 215 | 215 | } |
| 216 | - if (is_dir($path . '/' . $file) && preg_match('%^[a-z0-9_/]+$%i', $file . '/')) { |
|
| 217 | - $this->getControllerFiles($module, $namespace . $file . '\\', $prefix . $file . '/', $result); |
|
| 216 | + if (is_dir($path.'/'.$file) && preg_match('%^[a-z0-9_/]+$%i', $file.'/')) { |
|
| 217 | + $this->getControllerFiles($module, $namespace.$file.'\\', $prefix.$file.'/', $result); |
|
| 218 | 218 | } elseif (strcmp(substr($file, -14), 'Controller.php') === 0) { |
| 219 | 219 | $baseName = substr(basename($file), 0, -14); |
| 220 | 220 | $name = strtolower(preg_replace('/(?<![A-Z])[A-Z]/', ' \0', $baseName)); |
| 221 | 221 | $id = ltrim(str_replace(' ', '-', $name), '-'); |
| 222 | - $className = $namespace . $baseName . 'Controller'; |
|
| 222 | + $className = $namespace.$baseName.'Controller'; |
|
| 223 | 223 | if (strpos($className, '-') === false && class_exists($className) && is_subclass_of($className, 'yii\base\Controller')) { |
| 224 | - $this->getControllerActions($className, $prefix . $id, $module, $result); |
|
| 224 | + $this->getControllerActions($className, $prefix.$id, $module, $result); |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | } |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | protected function getControllerActions($type, $id, Module $module, &$result): void |
| 244 | 244 | { |
| 245 | - $token = 'Create controller with config=' . VarDumper::dumpAsString($type) . " and id='$id'"; |
|
| 245 | + $token = 'Create controller with config='.VarDumper::dumpAsString($type)." and id='$id'"; |
|
| 246 | 246 | Yii::beginProfile($token, __METHOD__); |
| 247 | 247 | |
| 248 | 248 | try { |
@@ -266,13 +266,13 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | protected function getActionRoutes(Controller $controller, &$result): void |
| 268 | 268 | { |
| 269 | - $token = "Get actions of controller '" . $controller->uniqueId . "'"; |
|
| 269 | + $token = "Get actions of controller '".$controller->uniqueId."'"; |
|
| 270 | 270 | Yii::beginProfile($token, __METHOD__); |
| 271 | 271 | |
| 272 | 272 | try { |
| 273 | - $prefix = '/' . $controller->uniqueId . '/'; |
|
| 273 | + $prefix = '/'.$controller->uniqueId.'/'; |
|
| 274 | 274 | foreach ($controller->actions() as $id => $value) { |
| 275 | - $result[$prefix . $id] = $prefix . $id; |
|
| 275 | + $result[$prefix.$id] = $prefix.$id; |
|
| 276 | 276 | } |
| 277 | 277 | $class = new \ReflectionClass($controller); |
| 278 | 278 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $name = $method->getName(); |
| 281 | 281 | if ($method->isPublic() && !$method->isStatic() && strpos($name, 'action') === 0 && $name !== 'actions') { |
| 282 | 282 | $name = strtolower(preg_replace('/(?<![A-Z])[A-Z]/', ' \0', substr($name, 6))); |
| 283 | - $id = $prefix . ltrim(str_replace(' ', '-', $name), '-'); |
|
| 283 | + $id = $prefix.ltrim(str_replace(' ', '-', $name), '-'); |
|
| 284 | 284 | $result[$id] = $id; |
| 285 | 285 | } |
| 286 | 286 | } |