@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\route\dispatch; |
14 | 14 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | if (strpos($controller, '.')) { |
55 | 55 | $pos = strrpos($controller, '.'); |
56 | - $this->controller = substr($controller, 0, $pos) . '.' . Str::studly(substr($controller, $pos + 1)); |
|
56 | + $this->controller = substr($controller, 0, $pos).'.'.Str::studly(substr($controller, $pos + 1)); |
|
57 | 57 | } else { |
58 | 58 | $this->controller = Str::studly($controller); |
59 | 59 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // 实例化控制器 |
74 | 74 | $instance = $this->controller($this->controller); |
75 | 75 | } catch (ClassNotFoundException $e) { |
76 | - throw new HttpException(404, 'controller not exists:' . $e->getClass()); |
|
76 | + throw new HttpException(404, 'controller not exists:'.$e->getClass()); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // 注册控制器中间件 |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | |
82 | 82 | return $this->app->middleware->pipeline('controller') |
83 | 83 | ->send($this->request) |
84 | - ->then(function () use ($instance) { |
|
84 | + ->then(function() use ($instance) { |
|
85 | 85 | // 获取当前操作名 |
86 | - $action = $this->actionName . $this->rule->config('action_suffix'); |
|
86 | + $action = $this->actionName.$this->rule->config('action_suffix'); |
|
87 | 87 | |
88 | 88 | if (is_callable([$instance, $action])) { |
89 | 89 | $vars = $this->request->param(); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | } else { |
101 | 101 | // 操作不存在 |
102 | - throw new HttpException(404, 'method not exists:' . get_class($instance) . '->' . $action . '()'); |
|
102 | + throw new HttpException(404, 'method not exists:'.get_class($instance).'->'.$action.'()'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | $data = $this->app->invokeReflectMethod($instance, $reflect, $vars); |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | |
127 | 127 | foreach ($middlewares as $key => $val) { |
128 | 128 | if (!is_int($key)) { |
129 | - if (isset($val['only']) && !in_array($this->request->action(true), array_map(function ($item) { |
|
129 | + if (isset($val['only']) && !in_array($this->request->action(true), array_map(function($item) { |
|
130 | 130 | return strtolower($item); |
131 | 131 | }, is_string($val['only']) ? explode(",", $val['only']) : $val['only']))) { |
132 | 132 | continue; |
133 | - } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function ($item) { |
|
133 | + } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function($item) { |
|
134 | 134 | return strtolower($item); |
135 | 135 | }, is_string($val['except']) ? explode(',', $val['except']) : $val['except']))) { |
136 | 136 | continue; |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | $controllerLayer = $this->rule->config('controller_layer') ?: 'controller'; |
163 | 163 | $emptyController = $this->rule->config('empty_controller') ?: 'Error'; |
164 | 164 | |
165 | - $class = $this->app->parseClass($controllerLayer, $name . $suffix); |
|
165 | + $class = $this->app->parseClass($controllerLayer, $name.$suffix); |
|
166 | 166 | |
167 | 167 | if (class_exists($class)) { |
168 | 168 | return $this->app->make($class, [], true); |
169 | - } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController . $suffix))) { |
|
169 | + } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController.$suffix))) { |
|
170 | 170 | return $this->app->make($emptyClass, [], true); |
171 | 171 | } |
172 | 172 | |
173 | - throw new ClassNotFoundException('class not exists:' . $class, $class); |
|
173 | + throw new ClassNotFoundException('class not exists:'.$class, $class); |
|
174 | 174 | } |
175 | 175 | } |