Completed
Push — 6.0 ( e89165...09da7f )
by liu
06:38 queued 15s
created
src/think/Event.php 1 patch
Spacing   +2 added lines, -2 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
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/think/filesystem/Driver.php 1 patch
Spacing   +2 added lines, -2 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\filesystem;
14 14
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/think/exception/Handle.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: yunwuxin <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\exception;
14 14
 
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
                     'code'    => $this->getCode($exception),
70 70
                     'message' => $this->getMessage($exception),
71 71
                 ];
72
-                $log  = "[{$data['code']}]{$data['message']}";
72
+                $log = "[{$data['code']}]{$data['message']}";
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/route/Url.php 1 patch
Spacing   +22 added lines, -22 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
     /**
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
                 $app        = empty($path) ? $app : array_pop($path);
256 256
             }
257 257
 
258
-            $url = $controller . '/' . $action;
258
+            $url = $controller.'/'.$action;
259 259
 
260 260
             if ($app && $this->app->config->get('app.auto_multi_app')) {
261 261
                 $bind = $this->app->config->get('app.domain_bind', []);
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
                     $map = $this->app->config->get('app.app_map', []);
266 266
 
267 267
                     if ($key = array_search($app, $map)) {
268
-                        $url = $key . '/' . $url;
268
+                        $url = $key.'/'.$url;
269 269
                     } else {
270
-                        $url = $app . '/' . $url;
270
+                        $url = $app.'/'.$url;
271 271
                     }
272 272
                 }
273 273
             }
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
     {
318 318
         $request = $this->app->request;
319 319
         if (is_string($allowDomain) && false === strpos($allowDomain, '.')) {
320
-            $allowDomain .= '.' . $request->rootDomain();
320
+            $allowDomain .= '.'.$request->rootDomain();
321 321
         }
322 322
 
323 323
         foreach ($rule as $item) {
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             }
336 336
 
337 337
             if (!in_array($request->port(), [80, 443])) {
338
-                $domain .= ':' . $request->port();
338
+                $domain .= ':'.$request->port();
339 339
             }
340 340
 
341 341
             if (empty($pattern)) {
@@ -346,12 +346,12 @@  discard block
 block discarded – undo
346 346
 
347 347
             foreach ($pattern as $key => $val) {
348 348
                 if (isset($vars[$key])) {
349
-                    $url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key, '<' . $key . '>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url);
349
+                    $url = str_replace(['[:'.$key.']', '<'.$key.'?>', ':'.$key, '<'.$key.'>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url);
350 350
                     unset($vars[$key]);
351 351
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
352 352
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
353 353
                 } elseif (2 == $val) {
354
-                    $url    = str_replace(['/[:' . $key . ']', '[:' . $key . ']', '<' . $key . '?>'], '', $url);
354
+                    $url    = str_replace(['/[:'.$key.']', '[:'.$key.']', '<'.$key.'?>'], '', $url);
355 355
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
356 356
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
357 357
                 } else {
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
         if (0 === strpos($url, '[') && $pos = strpos($url, ']')) {
380 380
             // [name] 表示使用路由命名标识生成URL
381 381
             $name = substr($url, 1, $pos - 1);
382
-            $url  = 'name' . substr($url, $pos + 1);
382
+            $url  = 'name'.substr($url, $pos + 1);
383 383
         }
384 384
 
385 385
         if (false === strpos($url, '://') && 0 !== strpos($url, '/')) {
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
         }
407 407
 
408 408
         if ($url) {
409
-            $checkName   = isset($name) ? $name : $url . (isset($info['query']) ? '?' . $info['query'] : '');
409
+            $checkName   = isset($name) ? $name : $url.(isset($info['query']) ? '?'.$info['query'] : '');
410 410
             $checkDomain = $domain && is_string($domain) ? $domain : null;
411 411
 
412 412
             $rule = $this->route->getName($checkName, $checkDomain);
@@ -433,10 +433,10 @@  discard block
 block discarded – undo
433 433
             }
434 434
 
435 435
             if ($request->app() && $this->app->config->get('app.auto_multi_app') && !$this->app->http->isBindDomain()) {
436
-                $url = $request->app() . '/' . $url;
436
+                $url = $request->app().'/'.$url;
437 437
             }
438 438
         } elseif (!empty($rule) && isset($name)) {
439
-            throw new \InvalidArgumentException('route name not exists:' . $name);
439
+            throw new \InvalidArgumentException('route name not exists:'.$name);
440 440
         } else {
441 441
             // 检测URL绑定
442 442
             $bind = $this->route->getDomainBind($domain && is_string($domain) ? $domain : null);
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
             $file = str_replace('\\', '/', dirname($file));
475 475
         }
476 476
 
477
-        $url = rtrim($file, '/') . '/' . $url;
477
+        $url = rtrim($file, '/').'/'.$url;
478 478
 
479 479
         // URL后缀
480 480
         if ('/' == substr($url, -1) || '' == $url) {
@@ -484,32 +484,32 @@  discard block
 block discarded – undo
484 484
         }
485 485
 
486 486
         // 锚点
487
-        $anchor = !empty($anchor) ? '#' . $anchor : '';
487
+        $anchor = !empty($anchor) ? '#'.$anchor : '';
488 488
 
489 489
         // 参数组装
490 490
         if (!empty($vars)) {
491 491
             // 添加参数
492 492
             if ($this->route->config('url_common_param')) {
493 493
                 $vars = http_build_query($vars);
494
-                $url .= $suffix . '?' . $vars . $anchor;
494
+                $url .= $suffix.'?'.$vars.$anchor;
495 495
             } else {
496 496
                 foreach ($vars as $var => $val) {
497 497
                     if ('' !== $val) {
498
-                        $url .= $depr . $var . $depr . urlencode((string) $val);
498
+                        $url .= $depr.$var.$depr.urlencode((string) $val);
499 499
                     }
500 500
                 }
501 501
 
502
-                $url .= $suffix . $anchor;
502
+                $url .= $suffix.$anchor;
503 503
             }
504 504
         } else {
505
-            $url .= $suffix . $anchor;
505
+            $url .= $suffix.$anchor;
506 506
         }
507 507
 
508 508
         // 检测域名
509 509
         $domain = $this->parseDomain($url, $domain);
510 510
 
511 511
         // URL组装
512
-        return $domain . rtrim($this->root, '/') . '/' . ltrim($url, '/');
512
+        return $domain.rtrim($this->root, '/').'/'.ltrim($url, '/');
513 513
     }
514 514
 
515 515
     public function __toString()
Please login to merge, or discard this patch.
src/think/Middleware.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/think/route/dispatch/Url.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\route\dispatch;
14 14
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
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
 
@@ -402,13 +402,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
                 // 泛二级域名
Please login to merge, or discard this patch.
src/think/console/command/RouteList.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
         }
49 49
 
50 50
         if ($app) {
51
-            $filename = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . $app . DIRECTORY_SEPARATOR . 'route_list.php';
51
+            $filename = $this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.$app.DIRECTORY_SEPARATOR.'route_list.php';
52 52
         } else {
53
-            $filename = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . 'route_list.php';
53
+            $filename = $this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.'route_list.php';
54 54
         }
55 55
 
56 56
         if (is_file($filename)) {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         }
61 61
 
62 62
         $content = $this->getRouteList($app);
63
-        file_put_contents($filename, 'Route List' . PHP_EOL . $content);
63
+        file_put_contents($filename, 'Route List'.PHP_EOL.$content);
64 64
     }
65 65
 
66 66
     protected function getRouteList(string $app = null): string
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
         $this->app->route->clear();
70 70
 
71 71
         if ($app) {
72
-            $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . $app . DIRECTORY_SEPARATOR;
72
+            $path = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.$app.DIRECTORY_SEPARATOR;
73 73
         } else {
74
-            $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR;
74
+            $path = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR;
75 75
         }
76 76
 
77 77
         $files = is_dir($path) ? scandir($path) : [];
78 78
 
79 79
         foreach ($files as $file) {
80 80
             if (strpos($file, '.php')) {
81
-                include $path . $file;
81
+                include $path.$file;
82 82
             }
83 83
         }
84 84
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                 $sort = $this->sortBy[$sort];
118 118
             }
119 119
 
120
-            uasort($rows, function ($a, $b) use ($sort) {
120
+            uasort($rows, function($a, $b) use ($sort) {
121 121
                 $itemA = $a[$sort] ?? null;
122 122
                 $itemB = $b[$sort] ?? null;
123 123
 
Please login to merge, or discard this patch.
src/think/Http.php 1 patch
Spacing   +27 added lines, -27 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
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     public function __construct(App $app)
59 59
     {
60 60
         $this->app   = $app;
61
-        $this->multi = is_dir($this->app->getBasePath() . 'controller') ? false : true;
61
+        $this->multi = is_dir($this->app->getBasePath().'controller') ? false : true;
62 62
     }
63 63
 
64 64
     /**
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 
192 192
         return $this->app->middleware->pipeline()
193 193
             ->send($request)
194
-            ->then(function ($request) {
194
+            ->then(function($request) {
195 195
                 return $this->dispatchToRoute($request);
196 196
             });
197 197
     }
198 198
 
199 199
     protected function dispatchToRoute($request)
200 200
     {
201
-        $withRoute = $this->app->config->get('app.with_route', true) ? function () {
201
+        $withRoute = $this->app->config->get('app.with_route', true) ? function() {
202 202
             $this->loadRoutes();
203 203
         } : null;
204 204
 
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
      */
211 211
     protected function loadMiddleware(): void
212 212
     {
213
-        if (is_file($this->app->getBasePath() . 'middleware.php')) {
214
-            $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php');
213
+        if (is_file($this->app->getBasePath().'middleware.php')) {
214
+            $this->app->middleware->import(include $this->app->getBasePath().'middleware.php');
215 215
         }
216 216
     }
217 217
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
         $routePath = $this->getRoutePath();
227 227
 
228 228
         if (is_dir($routePath)) {
229
-            $files = glob($routePath . '*.php');
229
+            $files = glob($routePath.'*.php');
230 230
             foreach ($files as $file) {
231 231
                 include $file;
232 232
             }
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
      */
243 243
     protected function getRoutePath(): string
244 244
     {
245
-        if ($this->isMulti() && is_dir($this->app->getAppPath() . 'route')) {
246
-            return $this->app->getAppPath() . 'route' . DIRECTORY_SEPARATOR;
245
+        if ($this->isMulti() && is_dir($this->app->getAppPath().'route')) {
246
+            return $this->app->getAppPath().'route'.DIRECTORY_SEPARATOR;
247 247
         }
248 248
 
249
-        return $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . ($this->isMulti() ? $this->getName() . DIRECTORY_SEPARATOR : '');
249
+        return $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.($this->isMulti() ? $this->getName().DIRECTORY_SEPARATOR : '');
250 250
     }
251 251
 
252 252
     /**
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
                         $appName = $map[$name];
335 335
                     }
336 336
                 } elseif ($name && (false !== array_search($name, $map) || in_array($name, $deny))) {
337
-                    throw new HttpException(404, 'app not exists:' . $name);
337
+                    throw new HttpException(404, 'app not exists:'.$name);
338 338
                 } elseif ($name && isset($map['*'])) {
339 339
                     $appName = $map['*'];
340 340
                 } else {
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
                 }
343 343
 
344 344
                 if ($name) {
345
-                    $this->app->request->setRoot('/' . $name);
345
+                    $this->app->request->setRoot('/'.$name);
346 346
                     $this->app->request->setPathinfo(strpos($path, '/') ? ltrim(strstr($path, '/'), '/') : '');
347 347
                 }
348 348
             }
@@ -361,11 +361,11 @@  discard block
 block discarded – undo
361 361
     {
362 362
         $this->name = $appName;
363 363
         $this->app->request->setApp($appName);
364
-        $this->app->setAppPath($this->path ?: $this->app->getBasePath() . $appName . DIRECTORY_SEPARATOR);
365
-        $this->app->setRuntimePath($this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . $appName . DIRECTORY_SEPARATOR);
364
+        $this->app->setAppPath($this->path ?: $this->app->getBasePath().$appName.DIRECTORY_SEPARATOR);
365
+        $this->app->setRuntimePath($this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.$appName.DIRECTORY_SEPARATOR);
366 366
 
367 367
         // 设置应用命名空间
368
-        $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\' . $appName);
368
+        $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\'.$appName);
369 369
 
370 370
         //加载应用
371 371
         $this->loadApp($appName);
@@ -382,34 +382,34 @@  discard block
 block discarded – undo
382 382
         if (is_dir($this->app->getAppPath())) {
383 383
             $appPath = $this->app->getAppPath();
384 384
 
385
-            if (is_file($appPath . 'common.php')) {
386
-                include_once $appPath . 'common.php';
385
+            if (is_file($appPath.'common.php')) {
386
+                include_once $appPath.'common.php';
387 387
             }
388 388
 
389 389
             $configPath = $this->app->getConfigPath();
390 390
 
391 391
             $files = [];
392 392
 
393
-            if (is_dir($appPath . 'config')) {
394
-                $files = array_merge($files, glob($appPath . 'config' . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt()));
395
-            } elseif (is_dir($configPath . $appName)) {
396
-                $files = array_merge($files, glob($configPath . $appName . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt()));
393
+            if (is_dir($appPath.'config')) {
394
+                $files = array_merge($files, glob($appPath.'config'.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt()));
395
+            } elseif (is_dir($configPath.$appName)) {
396
+                $files = array_merge($files, glob($configPath.$appName.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt()));
397 397
             }
398 398
 
399 399
             foreach ($files as $file) {
400 400
                 $this->app->config->load($file, pathinfo($file, PATHINFO_FILENAME));
401 401
             }
402 402
 
403
-            if (is_file($appPath . 'event.php')) {
404
-                $this->app->loadEvent(include $appPath . 'event.php');
403
+            if (is_file($appPath.'event.php')) {
404
+                $this->app->loadEvent(include $appPath.'event.php');
405 405
             }
406 406
 
407
-            if (is_file($appPath . 'middleware.php')) {
408
-                $this->app->middleware->import(include $appPath . 'middleware.php');
407
+            if (is_file($appPath.'middleware.php')) {
408
+                $this->app->middleware->import(include $appPath.'middleware.php');
409 409
             }
410 410
 
411
-            if (is_file($appPath . 'provider.php')) {
412
-                $this->app->bind(include $appPath . 'provider.php');
411
+            if (is_file($appPath.'provider.php')) {
412
+                $this->app->bind(include $appPath.'provider.php');
413 413
             }
414 414
         }
415 415
 
Please login to merge, or discard this patch.