Completed
Pull Request — 6.0 (#2052)
by
unknown
05:39
created
src/think/console/command/optimize/Route.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
     {
30 30
         $dir = $input->getArgument('dir') ?: '';
31 31
 
32
-        $path = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . ($dir ? $dir . DIRECTORY_SEPARATOR : '');
32
+        $path = $this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.($dir ? $dir.DIRECTORY_SEPARATOR : '');
33 33
 
34
-        $filename = $path . 'route.php';
34
+        $filename = $path.'route.php';
35 35
         if (is_file($filename)) {
36 36
             unlink($filename);
37 37
         }
@@ -46,21 +46,21 @@  discard block
 block discarded – undo
46 46
         $this->app->route->lazy(false);
47 47
 
48 48
         // 路由检测
49
-        $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . ($dir ? $dir . DIRECTORY_SEPARATOR : '');
49
+        $path = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.($dir ? $dir.DIRECTORY_SEPARATOR : '');
50 50
 
51 51
         $files = is_dir($path) ? scandir($path) : [];
52 52
 
53 53
         foreach ($files as $file) {
54 54
             if (strpos($file, '.php')) {
55
-                include $path . $file;
55
+                include $path.$file;
56 56
             }
57 57
         }
58 58
 
59 59
         //触发路由载入完成事件
60 60
         $this->app->event->trigger(RouteLoaded::class);
61 61
 
62
-        $content = '<?php ' . PHP_EOL . 'return ';
63
-        $content .= '\Opis\Closure\unserialize(\'' . \Opis\Closure\serialize($this->app->route->getName()) . '\');';
62
+        $content = '<?php '.PHP_EOL.'return ';
63
+        $content .= '\Opis\Closure\unserialize(\''.\Opis\Closure\serialize($this->app->route->getName()).'\');';
64 64
         return $content;
65 65
     }
66 66
 
Please login to merge, or discard this patch.
src/think/console/command/RouteList.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $dir = $input->getArgument('dir') ?: '';
44 44
 
45
-        $filename = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . ($dir ? $dir . DIRECTORY_SEPARATOR : '') . 'route_list.php';
45
+        $filename = $this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.($dir ? $dir.DIRECTORY_SEPARATOR : '').'route_list.php';
46 46
 
47 47
         if (is_file($filename)) {
48 48
             unlink($filename);
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         }
52 52
 
53 53
         $content = $this->getRouteList($dir);
54
-        file_put_contents($filename, 'Route List' . PHP_EOL . $content);
54
+        file_put_contents($filename, 'Route List'.PHP_EOL.$content);
55 55
     }
56 56
 
57 57
     protected function getRouteList(string $dir = null): string
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
         $this->app->route->clear();
61 61
 
62 62
         if ($dir) {
63
-            $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR;
63
+            $path = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR;
64 64
         } else {
65
-            $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR;
65
+            $path = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR;
66 66
         }
67 67
 
68 68
         $files = is_dir($path) ? scandir($path) : [];
69 69
 
70 70
         foreach ($files as $file) {
71 71
             if (strpos($file, '.php')) {
72
-                include $path . $file;
72
+                include $path.$file;
73 73
             }
74 74
         }
75 75
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                 $sort = $this->sortBy[$sort];
109 109
             }
110 110
 
111
-            uasort($rows, function ($a, $b) use ($sort) {
111
+            uasort($rows, function($a, $b) use ($sort) {
112 112
                 $itemA = $a[$sort] ?? null;
113 113
                 $itemB = $b[$sort] ?? null;
114 114
 
Please login to merge, or discard this patch.
tests/MiddlewareTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 
65 65
         $this->middleware->add('foo');
66 66
         $this->assertEquals(3, count($this->middleware->all()));
67
-        $this->middleware->add(function () {
67
+        $this->middleware->add(function() {
68 68
         });
69
-        $this->middleware->add(function () {
69
+        $this->middleware->add(function() {
70 70
         });
71 71
         $this->assertEquals(5, count($this->middleware->all()));
72 72
     }
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
         $handle->shouldReceive('report')->with($e)->andReturnNull();
86 86
         $handle->shouldReceive('render')->with($request, $e)->andReturn($response);
87 87
 
88
-        $foo->shouldReceive('handle')->once()->andReturnUsing(function ($request, $next) {
88
+        $foo->shouldReceive('handle')->once()->andReturnUsing(function($request, $next) {
89 89
             return $next($request);
90 90
         });
91
-        $bar->shouldReceive('handle')->once()->andReturnUsing(function ($request, $next) use ($e) {
91
+        $bar->shouldReceive('handle')->once()->andReturnUsing(function($request, $next) use ($e) {
92 92
             $next($request);
93 93
             throw  $e;
94 94
         });
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
 
100 100
         $this->config->shouldReceive('get')->once()->with('middleware.priority', [])->andReturn(['FooMiddleware', 'BarMiddleware']);
101 101
 
102
-        $this->middleware->import([function ($request, $next) {
102
+        $this->middleware->import([function($request, $next) {
103 103
             return $next($request);
104 104
         }, 'BarMiddleware', 'FooMiddleware']);
105 105
 
106 106
         $this->assertInstanceOf(Pipeline::class, $pipeline = $this->middleware->pipeline());
107 107
 
108
-        $pipeline->send($request)->then(function ($request) use ($e, $response) {
108
+        $pipeline->send($request)->then(function($request) use ($e, $response) {
109 109
             throw $e;
110 110
         });
111 111
 
Please login to merge, or discard this patch.
src/think/exception/Handle.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
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\exception;
14 14
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             }
74 74
 
75 75
             if ($this->app->config->get('log.record_trace')) {
76
-                $log .= PHP_EOL . $exception->getTraceAsString();
76
+                $log .= PHP_EOL.$exception->getTraceAsString();
77 77
             }
78 78
 
79 79
             $this->app->log->record($log, 'error');
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
         ob_start();
214 214
         $data = $this->convertExceptionToArray($exception);
215 215
         extract($data);
216
-        include $this->app->config->get('app.exception_tmpl') ?: __DIR__ . '/../../tpl/think_exception.tpl';
216
+        include $this->app->config->get('app.exception_tmpl') ?: __DIR__.'/../../tpl/think_exception.tpl';
217 217
 
218 218
         return ob_get_clean();
219 219
     }
@@ -255,10 +255,10 @@  discard block
 block discarded – undo
255 255
 
256 256
         if (strpos($message, ':')) {
257 257
             $name    = strstr($message, ':', true);
258
-            $message = $lang->has($name) ? $lang->get($name) . strstr($message, ':') : $message;
258
+            $message = $lang->has($name) ? $lang->get($name).strstr($message, ':') : $message;
259 259
         } elseif (strpos($message, ',')) {
260 260
             $name    = strstr($message, ',', true);
261
-            $message = $lang->has($name) ? $lang->get($name) . ':' . substr(strstr($message, ','), 1) : $message;
261
+            $message = $lang->has($name) ? $lang->get($name).':'.substr(strstr($message, ','), 1) : $message;
262 262
         } elseif ($lang->has($message)) {
263 263
             $message = $lang->get($message);
264 264
         }
Please login to merge, or discard this patch.
src/think/session/driver/File.php 1 patch
Spacing   +6 added lines, -6 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\session\driver;
14 14
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $this->config = array_merge($this->config, $config);
40 40
 
41 41
         if (empty($this->config['path'])) {
42
-            $this->config['path'] = $app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . 'session' . DIRECTORY_SEPARATOR;
42
+            $this->config['path'] = $app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.'session'.DIRECTORY_SEPARATOR;
43 43
         } elseif (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) {
44 44
             $this->config['path'] .= DIRECTORY_SEPARATOR;
45 45
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $lifetime = $this->config['expire'];
77 77
         $now      = time();
78 78
 
79
-        $files = $this->findFiles($this->config['path'], function (SplFileInfo $item) use ($lifetime, $now) {
79
+        $files = $this->findFiles($this->config['path'], function(SplFileInfo $item) use ($lifetime, $now) {
80 80
             return $now - $lifetime > $item->getMTime();
81 81
         });
82 82
 
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
     {
119 119
         if ($this->config['prefix']) {
120 120
             // 使用子目录
121
-            $name = $this->config['prefix'] . DIRECTORY_SEPARATOR . 'sess_' . $name;
121
+            $name = $this->config['prefix'].DIRECTORY_SEPARATOR.'sess_'.$name;
122 122
         } else {
123
-            $name = 'sess_' . $name;
123
+            $name = 'sess_'.$name;
124 124
         }
125 125
 
126
-        $filename = $this->config['path'] . $name;
126
+        $filename = $this->config['path'].$name;
127 127
         $dir      = dirname($filename);
128 128
 
129 129
         if ($auto && !is_dir($dir)) {
Please login to merge, or discard this patch.
src/think/Container.php 1 patch
Spacing   +9 added lines, -9 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;
14 14
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             return $this->make($abstract);
130 130
         }
131 131
 
132
-        throw new ClassNotFoundException('class not exists: ' . $abstract, $abstract);
132
+        throw new ClassNotFoundException('class not exists: '.$abstract, $abstract);
133 133
     }
134 134
 
135 135
     /**
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
             } else {
299 299
                 $function .= '()';
300 300
             }
301
-            throw new Exception('function not exists: ' . $function, 0, $e);
301
+            throw new Exception('function not exists: '.$function, 0, $e);
302 302
         }
303 303
     }
304 304
 
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
         } catch (ReflectionException $e) {
332 332
             if (is_array($method)) {
333 333
                 $class    = is_object($method[0]) ? get_class($method[0]) : $method[0];
334
-                $callback = $class . '::' . $method[1];
334
+                $callback = $class.'::'.$method[1];
335 335
             } else {
336 336
                 $callback = $method;
337 337
             }
338 338
 
339
-            throw new Exception('method not exists: ' . $callback . '()', 0, $e);
339
+            throw new Exception('method not exists: '.$callback.'()', 0, $e);
340 340
         }
341 341
     }
342 342
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
     public function invokeClass(string $class, array $vars = [])
383 383
     {
384 384
         if (!class_exists($class)) {
385
-            throw new ClassNotFoundException('class not exists: ' . $class, $class);
385
+            throw new ClassNotFoundException('class not exists: '.$class, $class);
386 386
         }
387 387
 
388 388
         $reflect = new ReflectionClass($class);
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
             } elseif ($param->isDefaultValueAvailable()) {
465 465
                 $args[] = $param->getDefaultValue();
466 466
             } else {
467
-                throw new InvalidArgumentException('method param miss:' . $name);
467
+                throw new InvalidArgumentException('method param miss:'.$name);
468 468
             }
469 469
         }
470 470
 
@@ -482,13 +482,13 @@  discard block
 block discarded – undo
482 482
      */
483 483
     public static function factory(string $name, string $namespace = '', ...$args)
484 484
     {
485
-        $class = false !== strpos($name, '\\') ? $name : $namespace . ucwords($name);
485
+        $class = false !== strpos($name, '\\') ? $name : $namespace.ucwords($name);
486 486
 
487 487
         if (class_exists($class)) {
488 488
             return Container::getInstance()->invokeClass($class, $args);
489 489
         }
490 490
 
491
-        throw new ClassNotFoundException('class not exists:' . $class, $class);
491
+        throw new ClassNotFoundException('class not exists:'.$class, $class);
492 492
     }
493 493
 
494 494
     /**
Please login to merge, or discard this patch.
src/think/route/dispatch/Controller.php 1 patch
Spacing   +11 added lines, -11 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
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
                 $data = $this->app->invokeReflectMethod($instance, $reflect, $vars);
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 
127 127
             foreach ($middlewares as $key => $val) {
128 128
                 if (!is_int($key)) {
129
-                    if (isset($val['only']) && !in_array($this->request->action(true), array_map(function ($item) {
129
+                    if (isset($val['only']) && !in_array($this->request->action(true), array_map(function($item) {
130 130
                             return strtolower($item);
131 131
                         }, is_string($val['only']) ? explode(",", $val['only']) : $val['only']))) {
132 132
                         continue;
133
-                    } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function ($item) {
133
+                    } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function($item) {
134 134
                             return strtolower($item);
135 135
                         }, is_string($val['except']) ? explode(',', $val['except']) : $val['except']))) {
136 136
                         continue;
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
         $controllerLayer = $this->rule->config('controller_layer') ?: 'controller';
163 163
         $emptyController = $this->rule->config('empty_controller') ?: 'Error';
164 164
 
165
-        $class = $this->app->parseClass($controllerLayer, $name . $suffix);
165
+        $class = $this->app->parseClass($controllerLayer, $name.$suffix);
166 166
 
167 167
         if (class_exists($class)) {
168 168
             return $this->app->make($class, [], true);
169
-        } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController . $suffix))) {
169
+        } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController.$suffix))) {
170 170
             return $this->app->make($emptyClass, [], true);
171 171
         }
172 172
 
173
-        throw new ClassNotFoundException('class not exists:' . $class, $class);
173
+        throw new ClassNotFoundException('class not exists:'.$class, $class);
174 174
     }
175 175
 }
Please login to merge, or discard this patch.
src/think/Route.php 1 patch
Spacing   +12 added lines, -12 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;
14 14
 
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
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
 
@@ -406,14 +406,14 @@  discard block
 block discarded – undo
406 406
         if (is_null($domain)) {
407 407
             $domain = $this->host;
408 408
         } elseif (false === strpos($domain, '.') && $this->request) {
409
-            $domain .= '.' . $this->request->rootDomain();
409
+            $domain .= '.'.$this->request->rootDomain();
410 410
         }
411 411
 
412 412
         if ($this->request) {
413 413
             $subDomain = $this->request->subDomain();
414 414
 
415 415
             if (strpos($subDomain, '.')) {
416
-                $name = '*' . strstr($subDomain, '.');
416
+                $name = '*'.strstr($subDomain, '.');
417 417
             }
418 418
         }
419 419
 
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
         $this->init();
747 747
 
748 748
         if ($withRoute) {
749
-            $checkCallback = function () use ($withRoute) {
749
+            $checkCallback = function() use ($withRoute) {
750 750
                 //加载路由
751 751
                 $withRoute();
752 752
                 return $this->check();
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 
768 768
         return $this->app->middleware->pipeline('route')
769 769
             ->send($request)
770
-            ->then(function () use ($dispatch) {
770
+            ->then(function() use ($dispatch) {
771 771
                 return $dispatch->run();
772 772
             });
773 773
     }
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
             $closure  = $this->config['route_check_cache_key'];
785 785
             $routeKey = $closure($request);
786 786
         } else {
787
-            $routeKey = md5($request->baseUrl(true) . ':' . $request->method());
787
+            $routeKey = md5($request->baseUrl(true).':'.$request->method());
788 788
         }
789 789
 
790 790
         return $routeKey;
@@ -834,10 +834,10 @@  discard block
 block discarded – undo
834 834
             $path = $pathinfo;
835 835
         } elseif ($suffix) {
836 836
             // 去除正常的URL后缀
837
-            $path = preg_replace('/\.(' . ltrim($suffix, '.') . ')$/i', '', $pathinfo);
837
+            $path = preg_replace('/\.('.ltrim($suffix, '.').')$/i', '', $pathinfo);
838 838
         } else {
839 839
             // 允许任何后缀访问
840
-            $path = preg_replace('/\.' . $this->request->ext() . '$/i', '', $pathinfo);
840
+            $path = preg_replace('/\.'.$this->request->ext().'$/i', '', $pathinfo);
841 841
         }
842 842
 
843 843
         return $path;
@@ -880,9 +880,9 @@  discard block
 block discarded – undo
880 880
                 $item = $this->domains[$this->host];
881 881
             } elseif (isset($this->domains[$subDomain])) {
882 882
                 $item = $this->domains[$subDomain];
883
-            } elseif (isset($this->domains['*.' . $domain2]) && !empty($domain3)) {
883
+            } elseif (isset($this->domains['*.'.$domain2]) && !empty($domain3)) {
884 884
                 // 泛三级域名
885
-                $item      = $this->domains['*.' . $domain2];
885
+                $item      = $this->domains['*.'.$domain2];
886 886
                 $panDomain = $domain3;
887 887
             } elseif (isset($this->domains['*']) && !empty($domain2)) {
888 888
                 // 泛二级域名
Please login to merge, or discard this patch.
src/think/route/Url.php 1 patch
Spacing   +19 added lines, -19 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;
14 14
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
                 }
191 191
             }
192 192
         } elseif (false === strpos($domain, '.') && 0 !== strpos($domain, $rootDomain)) {
193
-            $domain .= '.' . $rootDomain;
193
+            $domain .= '.'.$rootDomain;
194 194
         }
195 195
 
196 196
         if (false !== strpos($domain, '://')) {
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
             $scheme = $this->https || $request->isSsl() ? 'https://' : 'http://';
200 200
         }
201 201
 
202
-        return $scheme . $domain;
202
+        return $scheme.$domain;
203 203
     }
204 204
 
205 205
     /**
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
             }
219 219
         }
220 220
 
221
-        return (empty($suffix) || 0 === strpos($suffix, '.')) ? (string) $suffix : '.' . $suffix;
221
+        return (empty($suffix) || 0 === strpos($suffix, '.')) ? (string) $suffix : '.'.$suffix;
222 222
     }
223 223
 
224 224
     /**
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
             $action     = array_pop($path);
249 249
             $controller = empty($path) ? $controller : array_pop($path);
250 250
 
251
-            $url = $controller . '/' . $action;
251
+            $url = $controller.'/'.$action;
252 252
         }
253 253
 
254 254
         return $url;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     {
296 296
         $request = $this->app->request;
297 297
         if (is_string($allowDomain) && false === strpos($allowDomain, '.')) {
298
-            $allowDomain .= '.' . $request->rootDomain();
298
+            $allowDomain .= '.'.$request->rootDomain();
299 299
         }
300 300
         $port = $request->port();
301 301
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
             }
315 315
 
316 316
             if ($port && !in_array($port, [80, 443])) {
317
-                $domain .= ':' . $port;
317
+                $domain .= ':'.$port;
318 318
             }
319 319
 
320 320
             if (empty($pattern)) {
@@ -325,12 +325,12 @@  discard block
 block discarded – undo
325 325
 
326 326
             foreach ($pattern as $key => $val) {
327 327
                 if (isset($vars[$key])) {
328
-                    $url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key, '<' . $key . '>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url);
328
+                    $url = str_replace(['[:'.$key.']', '<'.$key.'?>', ':'.$key, '<'.$key.'>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url);
329 329
                     unset($vars[$key]);
330 330
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
331 331
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
332 332
                 } elseif (2 == $val) {
333
-                    $url    = str_replace(['/[:' . $key . ']', '[:' . $key . ']', '<' . $key . '?>'], '', $url);
333
+                    $url    = str_replace(['/[:'.$key.']', '[:'.$key.']', '<'.$key.'?>'], '', $url);
334 334
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
335 335
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
336 336
                 } else {
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         if (0 === strpos($url, '[') && $pos = strpos($url, ']')) {
359 359
             // [name] 表示使用路由命名标识生成URL
360 360
             $name = substr($url, 1, $pos - 1);
361
-            $url  = 'name' . substr($url, $pos + 1);
361
+            $url  = 'name'.substr($url, $pos + 1);
362 362
         }
363 363
 
364 364
         if (false === strpos($url, '://') && 0 !== strpos($url, '/')) {
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
         }
386 386
 
387 387
         if ($url) {
388
-            $checkName   = isset($name) ? $name : $url . (isset($info['query']) ? '?' . $info['query'] : '');
388
+            $checkName   = isset($name) ? $name : $url.(isset($info['query']) ? '?'.$info['query'] : '');
389 389
             $checkDomain = $domain && is_string($domain) ? $domain : null;
390 390
 
391 391
             $rule = $this->route->getName($checkName, $checkDomain);
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
                 $suffix = $match[2];
412 412
             }
413 413
         } elseif (!empty($rule) && isset($name)) {
414
-            throw new \InvalidArgumentException('route name not exists:' . $name);
414
+            throw new \InvalidArgumentException('route name not exists:'.$name);
415 415
         } else {
416 416
             // 检测URL绑定
417 417
             $bind = $this->route->getDomainBind($domain && is_string($domain) ? $domain : null);
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
             $file = str_replace('\\', '/', dirname($file));
450 450
         }
451 451
 
452
-        $url = rtrim($file, '/') . '/' . $url;
452
+        $url = rtrim($file, '/').'/'.$url;
453 453
 
454 454
         // URL后缀
455 455
         if ('/' == substr($url, -1) || '' == $url) {
@@ -459,33 +459,33 @@  discard block
 block discarded – undo
459 459
         }
460 460
 
461 461
         // 锚点
462
-        $anchor = !empty($anchor) ? '#' . $anchor : '';
462
+        $anchor = !empty($anchor) ? '#'.$anchor : '';
463 463
 
464 464
         // 参数组装
465 465
         if (!empty($vars)) {
466 466
             // 添加参数
467 467
             if ($this->route->config('url_common_param')) {
468 468
                 $vars = http_build_query($vars);
469
-                $url .= $suffix . '?' . $vars . $anchor;
469
+                $url .= $suffix.'?'.$vars.$anchor;
470 470
             } else {
471 471
                 foreach ($vars as $var => $val) {
472 472
                     $val = (string) $val;
473 473
                     if ('' !== $val) {
474
-                        $url .= $depr . $var . $depr . urlencode($val);
474
+                        $url .= $depr.$var.$depr.urlencode($val);
475 475
                     }
476 476
                 }
477 477
 
478
-                $url .= $suffix . $anchor;
478
+                $url .= $suffix.$anchor;
479 479
             }
480 480
         } else {
481
-            $url .= $suffix . $anchor;
481
+            $url .= $suffix.$anchor;
482 482
         }
483 483
 
484 484
         // 检测域名
485 485
         $domain = $this->parseDomain($url, $domain);
486 486
 
487 487
         // URL组装
488
-        return $domain . rtrim($this->root, '/') . '/' . ltrim($url, '/');
488
+        return $domain.rtrim($this->root, '/').'/'.ltrim($url, '/');
489 489
     }
490 490
 
491 491
     public function __toString()
Please login to merge, or discard this patch.