@@ -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 { |
@@ -927,9 +927,9 @@ discard block |
||
927 | 927 | $item = $this->domains[$this->host]; |
928 | 928 | } elseif (isset($this->domains[$subDomain])) { |
929 | 929 | $item = $this->domains[$subDomain]; |
930 | - } elseif (isset($this->domains['*.' . $domain2]) && !empty($domain3)) { |
|
930 | + } elseif (isset($this->domains['*.'.$domain2]) && !empty($domain3)) { |
|
931 | 931 | // 泛三级域名 |
932 | - $item = $this->domains['*.' . $domain2]; |
|
932 | + $item = $this->domains['*.'.$domain2]; |
|
933 | 933 | $panDomain = $domain3; |
934 | 934 | } elseif (isset($this->domains['*']) && !empty($domain2)) { |
935 | 935 | // 泛二级域名 |
@@ -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 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if ($bind && preg_match('/^[a-z]/is', $bind)) { |
48 | 48 | $bind = str_replace('/', $depr, $bind); |
49 | 49 | // 如果有域名绑定 |
50 | - $url = $bind . ('.' != substr($bind, -1) ? $depr : '') . ltrim($url, $depr); |
|
50 | + $url = $bind.('.' != substr($bind, -1) ? $depr : '').ltrim($url, $depr); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $path = $this->rule->parseUrlPath($url); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $controller = !empty($path) ? array_shift($path) : null; |
60 | 60 | |
61 | 61 | if ($controller && !preg_match('/^[A-Za-z][\w|\.]*$/', $controller)) { |
62 | - throw new HttpException(404, 'controller not exists:' . $controller); |
|
62 | + throw new HttpException(404, 'controller not exists:'.$controller); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | // 解析操作 |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | // 解析额外参数 |
70 | 70 | if ($path) { |
71 | - preg_replace_callback('/(\w+)\|([^\|]+)/', function ($match) use (&$var) { |
|
71 | + preg_replace_callback('/(\w+)\|([^\|]+)/', function($match) use (&$var) { |
|
72 | 72 | $var[$match[1]] = strip_tags($match[2]); |
73 | 73 | }, implode('|', $path)); |
74 | 74 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $route = [$controller, $action]; |
87 | 87 | |
88 | 88 | if ($this->hasDefinedRoute($route)) { |
89 | - throw new HttpException(404, 'invalid request:' . str_replace('|', $depr, $url)); |
|
89 | + throw new HttpException(404, 'invalid request:'.str_replace('|', $depr, $url)); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return $route; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | list($controller, $action) = $route; |
104 | 104 | |
105 | 105 | // 检查地址是否被定义过路由 |
106 | - $name = strtolower(Str::studly($controller) . '/' . $action); |
|
106 | + $name = strtolower(Str::studly($controller).'/'.$action); |
|
107 | 107 | |
108 | 108 | $host = $this->request->host(true); |
109 | 109 | $method = $this->request->method(); |