Completed
Push — 6.0 ( 50e0b0...f5a91c )
by liu
07:10
created
src/think/route/dispatch/Controller.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
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
 
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
             // 实例化控制器
69 69
             $instance = $this->controller($this->controller);
70 70
         } catch (ClassNotFoundException $e) {
71
-            throw new HttpException(404, 'controller not exists:' . $e->getClass());
71
+            throw new HttpException(404, 'controller not exists:'.$e->getClass());
72 72
         }
73 73
 
74 74
         // 注册控制器中间件
75 75
         $this->registerControllerMiddleware($instance);
76 76
 
77
-        $this->app->middleware->controller(function (Request $request, $next) use ($instance) {
77
+        $this->app->middleware->controller(function(Request $request, $next) use ($instance) {
78 78
             // 获取当前操作名
79
-            $action = $this->actionName . $this->rule->config('action_suffix');
79
+            $action = $this->actionName.$this->rule->config('action_suffix');
80 80
 
81 81
             if (is_callable([$instance, $action])) {
82 82
                 $vars = $this->request->param();
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                 }
93 93
             } else {
94 94
                 // 操作不存在
95
-                throw new HttpException(404, 'method not exists:' . get_class($instance) . '->' . $action . '()');
95
+                throw new HttpException(404, 'method not exists:'.get_class($instance).'->'.$action.'()');
96 96
             }
97 97
 
98 98
             $data = $this->app->invokeReflectMethod($instance, $reflect, $vars);
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
 
122 122
             foreach ($middlewares as $key => $val) {
123 123
                 if (!is_int($key)) {
124
-                    if (isset($val['only']) && !in_array($this->request->action(true), array_map(function ($item) {
124
+                    if (isset($val['only']) && !in_array($this->request->action(true), array_map(function($item) {
125 125
                         return strtolower($item);
126 126
                     }, $val['only']))) {
127 127
                         continue;
128
-                    } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function ($item) {
128
+                    } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function($item) {
129 129
                         return strtolower($item);
130 130
                     }, $val['except']))) {
131 131
                         continue;
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
         $controllerLayer = $this->rule->config('controller_layer') ?: 'controller';
154 154
         $emptyController = $this->rule->config('empty_controller') ?: 'Error';
155 155
 
156
-        $class = $this->app->parseClass($controllerLayer, $name . $suffix);
156
+        $class = $this->app->parseClass($controllerLayer, $name.$suffix);
157 157
 
158 158
         if (class_exists($class)) {
159 159
             return $this->app->make($class, [], true);
160
-        } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController . $suffix))) {
160
+        } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController.$suffix))) {
161 161
             return $this->app->make($emptyClass, [], true);
162 162
         }
163 163
 
164
-        throw new ClassNotFoundException('class not exists:' . $class, $class);
164
+        throw new ClassNotFoundException('class not exists:'.$class, $class);
165 165
     }
166 166
 }
Please login to merge, or discard this patch.