@@ -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) |
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) |
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) |
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) |
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 | } |
@@ -6,10 +6,10 @@ |
||
6 | 6 | define('YII_ENABLE_ERROR_HANDLER', false); |
7 | 7 | define('YII_DEBUG', true); |
8 | 8 | |
9 | -$_SERVER['SCRIPT_NAME'] = '/' . __DIR__; |
|
9 | +$_SERVER['SCRIPT_NAME'] = '/'.__DIR__; |
|
10 | 10 | $_SERVER['SCRIPT_FILENAME'] = __FILE__; |
11 | 11 | |
12 | -require_once(__DIR__ . '/../vendor/autoload.php'); |
|
13 | -require_once(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); |
|
12 | +require_once(__DIR__.'/../vendor/autoload.php'); |
|
13 | +require_once(__DIR__.'/../vendor/yiisoft/yii2/Yii.php'); |
|
14 | 14 | |
15 | 15 | Yii::setAlias('@yii2mod/rbac', dirname(__DIR__)); |