| @@ -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 | return $this->app->invokeReflectMethod($instance, $reflect, $vars); | 
| @@ -124,11 +124,11 @@ discard block | ||
| 124 | 124 | |
| 125 | 125 |              foreach ($middlewares as $key => $val) { | 
| 126 | 126 |                  if (!is_int($key)) { | 
| 127 | -                    if (isset($val['only']) && !in_array($this->request->action(true), array_map(function ($item) { | |
| 127 | +                    if (isset($val['only']) && !in_array($this->request->action(true), array_map(function($item) { | |
| 128 | 128 | return strtolower($item); | 
| 129 | 129 |                          }, is_string($val['only']) ? explode(",", $val['only']) : $val['only']))) { | 
| 130 | 130 | continue; | 
| 131 | -                    } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function ($item) { | |
| 131 | +                    } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function($item) { | |
| 132 | 132 | return strtolower($item); | 
| 133 | 133 |                          }, is_string($val['except']) ? explode(',', $val['except']) : $val['except']))) { | 
| 134 | 134 | continue; | 
| @@ -160,14 +160,14 @@ discard block | ||
| 160 | 160 |          $controllerLayer = $this->rule->config('controller_layer') ?: 'controller'; | 
| 161 | 161 |          $emptyController = $this->rule->config('empty_controller') ?: 'Error'; | 
| 162 | 162 | |
| 163 | - $class = $this->app->parseClass($controllerLayer, $name . $suffix); | |
| 163 | + $class = $this->app->parseClass($controllerLayer, $name.$suffix); | |
| 164 | 164 | |
| 165 | 165 |          if (class_exists($class)) { | 
| 166 | 166 | return $this->app->make($class, [], true); | 
| 167 | -        } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController . $suffix))) { | |
| 167 | +        } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController.$suffix))) { | |
| 168 | 168 | return $this->app->make($emptyClass, [], true); | 
| 169 | 169 | } | 
| 170 | 170 | |
| 171 | -        throw new ClassNotFoundException('class not exists:' . $class, $class); | |
| 171 | +        throw new ClassNotFoundException('class not exists:'.$class, $class); | |
| 172 | 172 | } | 
| 173 | 173 | } |