@@ -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 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | foreach ($methods as $method) { |
| 222 | 222 | $name = $method->getName(); |
| 223 | 223 | if (0 === strpos($name, 'on')) { |
| 224 | - $this->listen($prefix . substr($name, 2), [$observer, $name]); |
|
| 224 | + $this->listen($prefix.substr($name, 2), [$observer, $name]); |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | // +---------------------------------------------------------------------- |
| 9 | 9 | // | Author: yunwuxin <[email protected]> |
| 10 | 10 | // +---------------------------------------------------------------------- |
| 11 | -declare (strict_types = 1); |
|
| 11 | +declare(strict_types=1); |
|
| 12 | 12 | |
| 13 | 13 | namespace think\filesystem; |
| 14 | 14 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | public function putFileAs(string $path, File $file, string $name, array $options = []) |
| 116 | 116 | { |
| 117 | 117 | $stream = fopen($file->getRealPath(), 'r'); |
| 118 | - $path = trim($path . '/' . $name, '/'); |
|
| 118 | + $path = trim($path.'/'.$name, '/'); |
|
| 119 | 119 | |
| 120 | 120 | $result = $this->putStream($path, $stream, $options); |
| 121 | 121 | |
@@ -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\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(); |
@@ -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 | |
@@ -170,9 +170,9 @@ discard block |
||
| 170 | 170 | $this->ruleName = new RuleName(); |
| 171 | 171 | $this->setDefaultDomain(); |
| 172 | 172 | |
| 173 | - if (is_file($this->app->getRuntimePath() . 'route.php')) { |
|
| 173 | + if (is_file($this->app->getRuntimePath().'route.php')) { |
|
| 174 | 174 | // 读取路由映射文件 |
| 175 | - $this->import(include $this->app->getRuntimePath() . 'route.php'); |
|
| 175 | + $this->import(include $this->app->getRuntimePath().'route.php'); |
|
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
@@ -402,13 +402,13 @@ discard block |
||
| 402 | 402 | if (is_null($domain)) { |
| 403 | 403 | $domain = $this->host; |
| 404 | 404 | } elseif (false === strpos($domain, '.')) { |
| 405 | - $domain .= '.' . $this->request->rootDomain(); |
|
| 405 | + $domain .= '.'.$this->request->rootDomain(); |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | $subDomain = $this->request->subDomain(); |
| 409 | 409 | |
| 410 | 410 | if (strpos($subDomain, '.')) { |
| 411 | - $name = '*' . strstr($subDomain, '.'); |
|
| 411 | + $name = '*'.strstr($subDomain, '.'); |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | if (isset($this->bind[$domain])) { |
@@ -740,7 +740,7 @@ discard block |
||
| 740 | 740 | $this->init(); |
| 741 | 741 | |
| 742 | 742 | if ($withRoute) { |
| 743 | - $checkCallback = function () use ($withRoute) { |
|
| 743 | + $checkCallback = function() use ($withRoute) { |
|
| 744 | 744 | //加载路由 |
| 745 | 745 | $withRoute(); |
| 746 | 746 | return $this->check(); |
@@ -761,7 +761,7 @@ discard block |
||
| 761 | 761 | |
| 762 | 762 | return $this->app->middleware->pipeline('route') |
| 763 | 763 | ->send($request) |
| 764 | - ->then(function () use ($dispatch) { |
|
| 764 | + ->then(function() use ($dispatch) { |
|
| 765 | 765 | return $dispatch->run(); |
| 766 | 766 | }); |
| 767 | 767 | } |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | $closure = $this->config['route_check_cache_key']; |
| 779 | 779 | $routeKey = $closure($request); |
| 780 | 780 | } else { |
| 781 | - $routeKey = md5($request->baseUrl(true) . ':' . $request->method()); |
|
| 781 | + $routeKey = md5($request->baseUrl(true).':'.$request->method()); |
|
| 782 | 782 | } |
| 783 | 783 | |
| 784 | 784 | return $routeKey; |
@@ -828,10 +828,10 @@ discard block |
||
| 828 | 828 | $path = $pathinfo; |
| 829 | 829 | } elseif ($suffix) { |
| 830 | 830 | // 去除正常的URL后缀 |
| 831 | - $path = preg_replace('/\.(' . ltrim($suffix, '.') . ')$/i', '', $pathinfo); |
|
| 831 | + $path = preg_replace('/\.('.ltrim($suffix, '.').')$/i', '', $pathinfo); |
|
| 832 | 832 | } else { |
| 833 | 833 | // 允许任何后缀访问 |
| 834 | - $path = preg_replace('/\.' . $this->request->ext() . '$/i', '', $pathinfo); |
|
| 834 | + $path = preg_replace('/\.'.$this->request->ext().'$/i', '', $pathinfo); |
|
| 835 | 835 | } |
| 836 | 836 | |
| 837 | 837 | return $path; |
@@ -874,9 +874,9 @@ discard block |
||
| 874 | 874 | $item = $this->domains[$this->host]; |
| 875 | 875 | } elseif (isset($this->domains[$subDomain])) { |
| 876 | 876 | $item = $this->domains[$subDomain]; |
| 877 | - } elseif (isset($this->domains['*.' . $domain2]) && !empty($domain3)) { |
|
| 877 | + } elseif (isset($this->domains['*.'.$domain2]) && !empty($domain3)) { |
|
| 878 | 878 | // 泛三级域名 |
| 879 | - $item = $this->domains['*.' . $domain2]; |
|
| 879 | + $item = $this->domains['*.'.$domain2]; |
|
| 880 | 880 | $panDomain = $domain3; |
| 881 | 881 | } elseif (isset($this->domains['*']) && !empty($domain2)) { |
| 882 | 882 | // 泛二级域名 |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $route = m::mock(Route::class); |
| 49 | 49 | |
| 50 | - $route->shouldReceive('dispatch')->withArgs(function ($req, $withRoute) use ($request) { |
|
| 50 | + $route->shouldReceive('dispatch')->withArgs(function($req, $withRoute) use ($request) { |
|
| 51 | 51 | if ($withRoute) { |
| 52 | 52 | $withRoute(); |
| 53 | 53 | } |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | ], |
| 78 | 78 | ]); |
| 79 | 79 | |
| 80 | - $this->app->shouldReceive('getBasePath')->andReturn($root->getChild('app')->url() . DIRECTORY_SEPARATOR); |
|
| 81 | - $this->app->shouldReceive('getRootPath')->andReturn($root->url() . DIRECTORY_SEPARATOR); |
|
| 80 | + $this->app->shouldReceive('getBasePath')->andReturn($root->getChild('app')->url().DIRECTORY_SEPARATOR); |
|
| 81 | + $this->app->shouldReceive('getRootPath')->andReturn($root->url().DIRECTORY_SEPARATOR); |
|
| 82 | 82 | |
| 83 | 83 | $request = m::mock(Request::class)->makePartial(); |
| 84 | 84 | $response = m::mock(Response::class)->makePartial(); |
@@ -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 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | $this->app = $app; |
| 54 | 54 | |
| 55 | - $this->routePath = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR; |
|
| 55 | + $this->routePath = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -199,14 +199,14 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | return $this->app->middleware->pipeline() |
| 201 | 201 | ->send($request) |
| 202 | - ->then(function ($request) { |
|
| 202 | + ->then(function($request) { |
|
| 203 | 203 | return $this->dispatchToRoute($request); |
| 204 | 204 | }); |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | protected function dispatchToRoute($request) |
| 208 | 208 | { |
| 209 | - $withRoute = $this->app->config->get('app.with_route', true) ? function () { |
|
| 209 | + $withRoute = $this->app->config->get('app.with_route', true) ? function() { |
|
| 210 | 210 | $this->loadRoutes(); |
| 211 | 211 | } : null; |
| 212 | 212 | |
@@ -218,8 +218,8 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | protected function loadMiddleware(): void |
| 220 | 220 | { |
| 221 | - if (is_file($this->app->getBasePath() . 'middleware.php')) { |
|
| 222 | - $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php'); |
|
| 221 | + if (is_file($this->app->getBasePath().'middleware.php')) { |
|
| 222 | + $this->app->middleware->import(include $this->app->getBasePath().'middleware.php'); |
|
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | 225 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $routePath = $this->getRoutePath(); |
| 235 | 235 | |
| 236 | 236 | if (is_dir($routePath)) { |
| 237 | - $files = glob($routePath . '*.php'); |
|
| 237 | + $files = glob($routePath.'*.php'); |
|
| 238 | 238 | foreach ($files as $file) { |
| 239 | 239 | include $file; |
| 240 | 240 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | // +---------------------------------------------------------------------- |
| 9 | 9 | // | Author: yunwuxin <[email protected]> |
| 10 | 10 | // +---------------------------------------------------------------------- |
| 11 | -declare (strict_types = 1); |
|
| 11 | +declare(strict_types=1); |
|
| 12 | 12 | |
| 13 | 13 | namespace think\console; |
| 14 | 14 | |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | ]; |
| 405 | 405 | $replacements = [ |
| 406 | 406 | $name, |
| 407 | - $_SERVER['PHP_SELF'] . ' ' . $name, |
|
| 407 | + $_SERVER['PHP_SELF'].' '.$name, |
|
| 408 | 408 | ]; |
| 409 | 409 | |
| 410 | 410 | return str_replace($placeholders, $replacements, $this->getHelp()); |
@@ -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\view\driver; |
| 14 | 14 | |
@@ -78,14 +78,14 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | // 模板不存在 抛出异常 |
| 80 | 80 | if (!is_file($template)) { |
| 81 | - throw new RuntimeException('template not exists:' . $template); |
|
| 81 | + throw new RuntimeException('template not exists:'.$template); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $this->template = $template; |
| 85 | 85 | |
| 86 | 86 | // 记录视图信息 |
| 87 | 87 | $this->app->log |
| 88 | - ->record('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]'); |
|
| 88 | + ->record('[ VIEW ] '.$template.' [ '.var_export(array_keys($data), true).' ]'); |
|
| 89 | 89 | |
| 90 | 90 | extract($data, EXTR_OVERWRITE); |
| 91 | 91 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $this->content = $content; |
| 105 | 105 | |
| 106 | 106 | extract($data, EXTR_OVERWRITE); |
| 107 | - eval('?>' . $this->content); |
|
| 107 | + eval('?>'.$this->content); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -129,10 +129,10 @@ discard block |
||
| 129 | 129 | $appName = isset($app) ? $app : $this->app->http->getName(); |
| 130 | 130 | $view = $this->config['view_dir_name']; |
| 131 | 131 | |
| 132 | - if (is_dir($this->app->getAppPath() . $view)) { |
|
| 133 | - $path = isset($app) ? $this->app->getBasePath() . ($appName ? $appName . DIRECTORY_SEPARATOR : '') . $view . DIRECTORY_SEPARATOR : $this->app->getAppPath() . $view . DIRECTORY_SEPARATOR; |
|
| 132 | + if (is_dir($this->app->getAppPath().$view)) { |
|
| 133 | + $path = isset($app) ? $this->app->getBasePath().($appName ? $appName.DIRECTORY_SEPARATOR : '').$view.DIRECTORY_SEPARATOR : $this->app->getAppPath().$view.DIRECTORY_SEPARATOR; |
|
| 134 | 134 | } else { |
| 135 | - $path = $this->app->getRootPath() . $view . DIRECTORY_SEPARATOR . ($appName ? $appName . DIRECTORY_SEPARATOR : ''); |
|
| 135 | + $path = $this->app->getRootPath().$view.DIRECTORY_SEPARATOR.($appName ? $appName.DIRECTORY_SEPARATOR : ''); |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $controller = $request->controller(); |
| 144 | 144 | if (strpos($controller, '.')) { |
| 145 | 145 | $pos = strrpos($controller, '.'); |
| 146 | - $controller = substr($controller, 0, $pos) . '.' . Str::snake(substr($controller, $pos + 1)); |
|
| 146 | + $controller = substr($controller, 0, $pos).'.'.Str::snake(substr($controller, $pos + 1)); |
|
| 147 | 147 | } else { |
| 148 | 148 | $controller = Str::snake($controller); |
| 149 | 149 | } |
@@ -159,16 +159,16 @@ discard block |
||
| 159 | 159 | $template = Str::snake($request->action()); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; |
|
| 162 | + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template; |
|
| 163 | 163 | } elseif (false === strpos($template, $depr)) { |
| 164 | - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; |
|
| 164 | + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template; |
|
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | } else { |
| 168 | 168 | $template = str_replace(['/', ':'], $depr, substr($template, 1)); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.'); |
|
| 171 | + return $path.ltrim($template, '/').'.'.ltrim($this->config['view_suffix'], '.'); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |