Completed
Push — 6.0 ( 40cdd9...30a204 )
by liu
06:40
created
src/think/route/Url.php 1 patch
Spacing   +18 added lines, -18 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
     /**
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
     {
288 288
         $request = $this->app->request;
289 289
         if (is_string($allowDomain) && false === strpos($allowDomain, '.')) {
290
-            $allowDomain .= '.' . $request->rootDomain();
290
+            $allowDomain .= '.'.$request->rootDomain();
291 291
         }
292 292
 
293 293
         foreach ($rule as $item) {
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
             }
306 306
 
307 307
             if (!in_array($request->port(), [80, 443])) {
308
-                $domain .= ':' . $request->port();
308
+                $domain .= ':'.$request->port();
309 309
             }
310 310
 
311 311
             if (empty($pattern)) {
@@ -316,12 +316,12 @@  discard block
 block discarded – undo
316 316
 
317 317
             foreach ($pattern as $key => $val) {
318 318
                 if (isset($vars[$key])) {
319
-                    $url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key, '<' . $key . '>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url);
319
+                    $url = str_replace(['[:'.$key.']', '<'.$key.'?>', ':'.$key, '<'.$key.'>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url);
320 320
                     unset($vars[$key]);
321 321
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
322 322
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
323 323
                 } elseif (2 == $val) {
324
-                    $url    = str_replace(['/[:' . $key . ']', '[:' . $key . ']', '<' . $key . '?>'], '', $url);
324
+                    $url    = str_replace(['/[:'.$key.']', '[:'.$key.']', '<'.$key.'?>'], '', $url);
325 325
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
326 326
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
327 327
                 } else {
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
         if (0 === strpos($url, '[') && $pos = strpos($url, ']')) {
350 350
             // [name] 表示使用路由命名标识生成URL
351 351
             $name = substr($url, 1, $pos - 1);
352
-            $url  = 'name' . substr($url, $pos + 1);
352
+            $url  = 'name'.substr($url, $pos + 1);
353 353
         }
354 354
 
355 355
         if (false === strpos($url, '://') && 0 !== strpos($url, '/')) {
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
         }
377 377
 
378 378
         if ($url) {
379
-            $checkName   = isset($name) ? $name : $url . (isset($info['query']) ? '?' . $info['query'] : '');
379
+            $checkName   = isset($name) ? $name : $url.(isset($info['query']) ? '?'.$info['query'] : '');
380 380
             $checkDomain = $domain && is_string($domain) ? $domain : null;
381 381
 
382 382
             $rule = $this->route->getName($checkName, $checkDomain);
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
                 $suffix = $match[2];
403 403
             }
404 404
         } elseif (!empty($rule) && isset($name)) {
405
-            throw new \InvalidArgumentException('route name not exists:' . $name);
405
+            throw new \InvalidArgumentException('route name not exists:'.$name);
406 406
         } else {
407 407
             // 检测URL绑定
408 408
             $bind = $this->route->getDomainBind($domain && is_string($domain) ? $domain : null);
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
             $file = str_replace('\\', '/', dirname($file));
441 441
         }
442 442
 
443
-        $url = rtrim($file, '/') . '/' . $url;
443
+        $url = rtrim($file, '/').'/'.$url;
444 444
 
445 445
         // URL后缀
446 446
         if ('/' == substr($url, -1) || '' == $url) {
@@ -450,32 +450,32 @@  discard block
 block discarded – undo
450 450
         }
451 451
 
452 452
         // 锚点
453
-        $anchor = !empty($anchor) ? '#' . $anchor : '';
453
+        $anchor = !empty($anchor) ? '#'.$anchor : '';
454 454
 
455 455
         // 参数组装
456 456
         if (!empty($vars)) {
457 457
             // 添加参数
458 458
             if ($this->route->config('url_common_param')) {
459 459
                 $vars = http_build_query($vars);
460
-                $url .= $suffix . '?' . $vars . $anchor;
460
+                $url .= $suffix.'?'.$vars.$anchor;
461 461
             } else {
462 462
                 foreach ($vars as $var => $val) {
463 463
                     if ('' !== $val) {
464
-                        $url .= $depr . $var . $depr . urlencode((string) $val);
464
+                        $url .= $depr.$var.$depr.urlencode((string) $val);
465 465
                     }
466 466
                 }
467 467
 
468
-                $url .= $suffix . $anchor;
468
+                $url .= $suffix.$anchor;
469 469
             }
470 470
         } else {
471
-            $url .= $suffix . $anchor;
471
+            $url .= $suffix.$anchor;
472 472
         }
473 473
 
474 474
         // 检测域名
475 475
         $domain = $this->parseDomain($url, $domain);
476 476
 
477 477
         // URL组装
478
-        return $domain . rtrim($this->root, '/') . '/' . ltrim($url, '/');
478
+        return $domain.rtrim($this->root, '/').'/'.ltrim($url, '/');
479 479
     }
480 480
 
481 481
     public function __toString()
Please login to merge, or discard this patch.
src/think/console/Command.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\console;
14 14
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
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());
Please login to merge, or discard this patch.
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->getOption('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   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
         $dir = $input->getOption('dir');
44 44
 
45 45
         if ($dir) {
46
-            $filename = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . 'route_list.php';
46
+            $filename = $this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.'route_list.php';
47 47
         } else {
48
-            $filename = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . 'route_list.php';
48
+            $filename = $this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.'route_list.php';
49 49
         }
50 50
 
51 51
         if (is_file($filename)) {
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         }
56 56
 
57 57
         $content = $this->getRouteList($dir);
58
-        file_put_contents($filename, 'Route List' . PHP_EOL . $content);
58
+        file_put_contents($filename, 'Route List'.PHP_EOL.$content);
59 59
     }
60 60
 
61 61
     protected function getRouteList(string $dir = null): string
@@ -64,16 +64,16 @@  discard block
 block discarded – undo
64 64
         $this->app->route->clear();
65 65
 
66 66
         if ($dir) {
67
-            $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR;
67
+            $path = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR;
68 68
         } else {
69
-            $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR;
69
+            $path = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR;
70 70
         }
71 71
 
72 72
         $files = is_dir($path) ? scandir($path) : [];
73 73
 
74 74
         foreach ($files as $file) {
75 75
             if (strpos($file, '.php')) {
76
-                include $path . $file;
76
+                include $path.$file;
77 77
             }
78 78
         }
79 79
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                 $sort = $this->sortBy[$sort];
113 113
             }
114 114
 
115
-            uasort($rows, function ($a, $b) use ($sort) {
115
+            uasort($rows, function($a, $b) use ($sort) {
116 116
                 $itemA = $a[$sort] ?? null;
117 117
                 $itemB = $b[$sort] ?? null;
118 118
 
Please login to merge, or discard this patch.