@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | // +---------------------------------------------------------------------- |
| 9 | 9 | // | Author: Slince <[email protected]> |
| 10 | 10 | // +---------------------------------------------------------------------- |
| 11 | -declare (strict_types = 1); |
|
| 11 | +declare(strict_types=1); |
|
| 12 | 12 | |
| 13 | 13 | namespace think; |
| 14 | 14 | |
@@ -128,8 +128,8 @@ discard block |
||
| 128 | 128 | public function pipeline(string $type = 'global') |
| 129 | 129 | { |
| 130 | 130 | return (new Pipeline()) |
| 131 | - ->through(array_map(function ($middleware) { |
|
| 132 | - return function ($request, $next) use ($middleware) { |
|
| 131 | + ->through(array_map(function($middleware) { |
|
| 132 | + return function($request, $next) use ($middleware) { |
|
| 133 | 133 | list($call, $param) = $middleware; |
| 134 | 134 | if (is_array($call) && is_string($call[0])) { |
| 135 | 135 | $call = [$this->app->make($call[0]), $call[1]]; |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | protected function sortMiddleware(array $middlewares) |
| 227 | 227 | { |
| 228 | 228 | $priority = $this->app->config->get('middleware.priority', []); |
| 229 | - uasort($middlewares, function ($a, $b) use ($priority) { |
|
| 229 | + uasort($middlewares, function($a, $b) use ($priority) { |
|
| 230 | 230 | $aPriority = $this->getMiddlewarePriority($priority, $a); |
| 231 | 231 | $bPriority = $this->getMiddlewarePriority($priority, $b); |
| 232 | 232 | return $bPriority - $aPriority; |
@@ -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; |
| 14 | 14 | |
@@ -177,9 +177,9 @@ discard block |
||
| 177 | 177 | $this->ruleName = new RuleName(); |
| 178 | 178 | $this->setDefaultDomain(); |
| 179 | 179 | |
| 180 | - if (is_file($this->app->getRuntimePath() . 'route.php')) { |
|
| 180 | + if (is_file($this->app->getRuntimePath().'route.php')) { |
|
| 181 | 181 | // 读取路由映射文件 |
| 182 | - $this->import(include $this->app->getRuntimePath() . 'route.php'); |
|
| 182 | + $this->import(include $this->app->getRuntimePath().'route.php'); |
|
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
@@ -420,13 +420,13 @@ discard block |
||
| 420 | 420 | if (is_null($domain)) { |
| 421 | 421 | $domain = $this->host; |
| 422 | 422 | } elseif (false === strpos($domain, '.')) { |
| 423 | - $domain .= '.' . $this->request->rootDomain(); |
|
| 423 | + $domain .= '.'.$this->request->rootDomain(); |
|
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | $subDomain = $this->request->subDomain(); |
| 427 | 427 | |
| 428 | 428 | if (strpos($subDomain, '.')) { |
| 429 | - $name = '*' . strstr($subDomain, '.'); |
|
| 429 | + $name = '*'.strstr($subDomain, '.'); |
|
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | if (isset($this->bind[$domain])) { |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | $this->init(); |
| 761 | 761 | |
| 762 | 762 | if ($withRoute) { |
| 763 | - $checkCallback = function () use ($withRoute) { |
|
| 763 | + $checkCallback = function() use ($withRoute) { |
|
| 764 | 764 | //加载路由 |
| 765 | 765 | $withRoute(); |
| 766 | 766 | return $this->check(); |
@@ -781,10 +781,10 @@ discard block |
||
| 781 | 781 | |
| 782 | 782 | return $this->app->middleware->pipeline() |
| 783 | 783 | ->send($request) |
| 784 | - ->then(function ($request) use ($dispatch) { |
|
| 784 | + ->then(function($request) use ($dispatch) { |
|
| 785 | 785 | return $this->app->middleware->pipeline('route') |
| 786 | 786 | ->send($request) |
| 787 | - ->then(function () use ($dispatch) { |
|
| 787 | + ->then(function() use ($dispatch) { |
|
| 788 | 788 | return $dispatch->run(); |
| 789 | 789 | }); |
| 790 | 790 | }); |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | $closure = $this->config['route_check_cache_key']; |
| 803 | 803 | $routeKey = $closure($request); |
| 804 | 804 | } else { |
| 805 | - $routeKey = md5($request->baseUrl(true) . ':' . $request->method()); |
|
| 805 | + $routeKey = md5($request->baseUrl(true).':'.$request->method()); |
|
| 806 | 806 | } |
| 807 | 807 | |
| 808 | 808 | return $routeKey; |
@@ -852,10 +852,10 @@ discard block |
||
| 852 | 852 | $path = $pathinfo; |
| 853 | 853 | } elseif ($suffix) { |
| 854 | 854 | // 去除正常的URL后缀 |
| 855 | - $path = preg_replace('/\.(' . ltrim($suffix, '.') . ')$/i', '', $pathinfo); |
|
| 855 | + $path = preg_replace('/\.('.ltrim($suffix, '.').')$/i', '', $pathinfo); |
|
| 856 | 856 | } else { |
| 857 | 857 | // 允许任何后缀访问 |
| 858 | - $path = preg_replace('/\.' . $this->request->ext() . '$/i', '', $pathinfo); |
|
| 858 | + $path = preg_replace('/\.'.$this->request->ext().'$/i', '', $pathinfo); |
|
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | return $path; |
@@ -884,7 +884,7 @@ discard block |
||
| 884 | 884 | $appName = $map[$name]; |
| 885 | 885 | } |
| 886 | 886 | } elseif ($name && (false !== array_search($name, $map) || in_array($name, $deny))) { |
| 887 | - throw new HttpException(404, 'app not exists:' . $name); |
|
| 887 | + throw new HttpException(404, 'app not exists:'.$name); |
|
| 888 | 888 | } elseif ($name && isset($map['*'])) { |
| 889 | 889 | $appName = $map['*']; |
| 890 | 890 | } else { |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | if ($name) { |
| 895 | - $this->request->setRoot('/' . $name); |
|
| 895 | + $this->request->setRoot('/'.$name); |
|
| 896 | 896 | $url = strpos($url, '|') ? ltrim(strstr($url, '|'), '|') : ''; |
| 897 | 897 | $this->request->setPathinfo(str_replace('|', $this->config['pathinfo_depr'], $url)); |
| 898 | 898 | } |
@@ -929,9 +929,9 @@ discard block |
||
| 929 | 929 | $item = $this->domains[$this->host]; |
| 930 | 930 | } elseif (isset($this->domains[$subDomain])) { |
| 931 | 931 | $item = $this->domains[$subDomain]; |
| 932 | - } elseif (isset($this->domains['*.' . $domain2]) && !empty($domain3)) { |
|
| 932 | + } elseif (isset($this->domains['*.'.$domain2]) && !empty($domain3)) { |
|
| 933 | 933 | // 泛三级域名 |
| 934 | - $item = $this->domains['*.' . $domain2]; |
|
| 934 | + $item = $this->domains['*.'.$domain2]; |
|
| 935 | 935 | $panDomain = $domain3; |
| 936 | 936 | } elseif (isset($this->domains['*']) && !empty($domain2)) { |
| 937 | 937 | // 泛二级域名 |