Completed
Push — 6.0 ( 4cd5e6...6217ae )
by yun
06:31
created
src/think/console/command/Build.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         $this->basePath = $this->app->getBasePath();
41 41
         $dir            = $input->getArgument('dir') ?: '';
42 42
 
43
-        $list = include $this->basePath . 'build.php';
43
+        $list = include $this->basePath.'build.php';
44 44
 
45 45
         if (empty($list)) {
46 46
             $output->writeln("Build file Is Empty");
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
      */
62 62
     protected function buildApp(string $dir, array $list = []): void
63 63
     {
64
-        if (!is_dir($this->basePath . $dir)) {
64
+        if (!is_dir($this->basePath.$dir)) {
65 65
             // 创建应用目录
66
-            mkdir($this->basePath . $dir);
66
+            mkdir($this->basePath.$dir);
67 67
         }
68 68
 
69
-        $appPath   = $this->basePath . ($dir ? $dir . DIRECTORY_SEPARATOR : '');
70
-        $namespace = 'app' . ($dir ? '\\' . $dir : '');
69
+        $appPath   = $this->basePath.($dir ? $dir.DIRECTORY_SEPARATOR : '');
70
+        $namespace = 'app'.($dir ? '\\'.$dir : '');
71 71
 
72 72
         // 创建配置文件和公共文件
73 73
         $this->buildCommon($dir);
@@ -78,41 +78,41 @@  discard block
 block discarded – undo
78 78
             if ('__dir__' == $path) {
79 79
                 // 生成子目录
80 80
                 foreach ($file as $dir) {
81
-                    $this->checkDirBuild($appPath . $dir);
81
+                    $this->checkDirBuild($appPath.$dir);
82 82
                 }
83 83
             } elseif ('__file__' == $path) {
84 84
                 // 生成(空白)文件
85 85
                 foreach ($file as $name) {
86
-                    if (!is_file($appPath . $name)) {
87
-                        file_put_contents($appPath . $name, 'php' == pathinfo($name, PATHINFO_EXTENSION) ? '<?php' . PHP_EOL : '');
86
+                    if (!is_file($appPath.$name)) {
87
+                        file_put_contents($appPath.$name, 'php' == pathinfo($name, PATHINFO_EXTENSION) ? '<?php'.PHP_EOL : '');
88 88
                     }
89 89
                 }
90 90
             } else {
91 91
                 // 生成相关MVC文件
92 92
                 foreach ($file as $val) {
93 93
                     $val      = trim($val);
94
-                    $filename = $appPath . $path . DIRECTORY_SEPARATOR . $val . '.php';
95
-                    $space    = $namespace . '\\' . $path;
94
+                    $filename = $appPath.$path.DIRECTORY_SEPARATOR.$val.'.php';
95
+                    $space    = $namespace.'\\'.$path;
96 96
                     $class    = $val;
97 97
                     switch ($path) {
98 98
                         case 'controller': // 控制器
99 99
                             if ($this->app->config->get('route.controller_suffix')) {
100
-                                $filename = $appPath . $path . DIRECTORY_SEPARATOR . $val . 'Controller.php';
101
-                                $class    = $val . 'Controller';
100
+                                $filename = $appPath.$path.DIRECTORY_SEPARATOR.$val.'Controller.php';
101
+                                $class    = $val.'Controller';
102 102
                             }
103
-                            $content = "<?php" . PHP_EOL . "namespace {$space};" . PHP_EOL . PHP_EOL . "class {$class}" . PHP_EOL . "{" . PHP_EOL . PHP_EOL . "}";
103
+                            $content = "<?php".PHP_EOL."namespace {$space};".PHP_EOL.PHP_EOL."class {$class}".PHP_EOL."{".PHP_EOL.PHP_EOL."}";
104 104
                             break;
105 105
                         case 'model': // 模型
106
-                            $content = "<?php" . PHP_EOL . "namespace {$space};" . PHP_EOL . PHP_EOL . "use think\Model;" . PHP_EOL . PHP_EOL . "class {$class} extends Model" . PHP_EOL . "{" . PHP_EOL . PHP_EOL . "}";
106
+                            $content = "<?php".PHP_EOL."namespace {$space};".PHP_EOL.PHP_EOL."use think\Model;".PHP_EOL.PHP_EOL."class {$class} extends Model".PHP_EOL."{".PHP_EOL.PHP_EOL."}";
107 107
                             break;
108 108
                         case 'view': // 视图
109
-                            $filename = $appPath . $path . DIRECTORY_SEPARATOR . $val . '.html';
109
+                            $filename = $appPath.$path.DIRECTORY_SEPARATOR.$val.'.html';
110 110
                             $this->checkDirBuild(dirname($filename));
111 111
                             $content = '';
112 112
                             break;
113 113
                         default:
114 114
                             // 其他文件
115
-                            $content = "<?php" . PHP_EOL . "namespace {$space};" . PHP_EOL . PHP_EOL . "class {$class}" . PHP_EOL . "{" . PHP_EOL . PHP_EOL . "}";
115
+                            $content = "<?php".PHP_EOL."namespace {$space};".PHP_EOL.PHP_EOL."class {$class}".PHP_EOL."{".PHP_EOL.PHP_EOL."}";
116 116
                     }
117 117
 
118 118
                     if (!is_file($filename)) {
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
     protected function buildHello(string $dir, string $namespace): void
134 134
     {
135 135
         $suffix   = $this->app->config->get('route.controller_suffix') ? 'Controller' : '';
136
-        $filename = $this->basePath . ($dir ? $dir . DIRECTORY_SEPARATOR : '') . 'controller' . DIRECTORY_SEPARATOR . 'Index' . $suffix . '.php';
136
+        $filename = $this->basePath.($dir ? $dir.DIRECTORY_SEPARATOR : '').'controller'.DIRECTORY_SEPARATOR.'Index'.$suffix.'.php';
137 137
 
138 138
         if (!is_file($filename)) {
139
-            $content = file_get_contents($this->app->getThinkPath() . 'tpl' . DIRECTORY_SEPARATOR . 'default_index.tpl');
139
+            $content = file_get_contents($this->app->getThinkPath().'tpl'.DIRECTORY_SEPARATOR.'default_index.tpl');
140 140
             $content = str_replace(['{%name%}', '{%app%}', '{%layer%}', '{%suffix%}'], [$dir, $namespace, 'controller', $suffix], $content);
141 141
             $this->checkDirBuild(dirname($filename));
142 142
 
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
      */
153 153
     protected function buildCommon(string $dir): void
154 154
     {
155
-        $appPath = $this->basePath . ($dir ? $dir . DIRECTORY_SEPARATOR : '');
155
+        $appPath = $this->basePath.($dir ? $dir.DIRECTORY_SEPARATOR : '');
156 156
 
157
-        if (!is_file($appPath . 'common.php')) {
158
-            file_put_contents($appPath . 'common.php', "<?php" . PHP_EOL . "// 这是系统自动生成的公共文件" . PHP_EOL);
157
+        if (!is_file($appPath.'common.php')) {
158
+            file_put_contents($appPath.'common.php', "<?php".PHP_EOL."// 这是系统自动生成的公共文件".PHP_EOL);
159 159
         }
160 160
 
161 161
         foreach (['event', 'middleware', 'provider'] as $name) {
162
-            if (!is_file($appPath . $name . '.php')) {
163
-                file_put_contents($appPath . $name . '.php', "<?php" . PHP_EOL . "// 这是系统自动生成的{$name}定义文件" . PHP_EOL . "return [" . PHP_EOL . PHP_EOL . "];" . PHP_EOL);
162
+            if (!is_file($appPath.$name.'.php')) {
163
+                file_put_contents($appPath.$name.'.php', "<?php".PHP_EOL."// 这是系统自动生成的{$name}定义文件".PHP_EOL."return [".PHP_EOL.PHP_EOL."];".PHP_EOL);
164 164
             }
165 165
         }
166 166
     }
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->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/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,32 +459,32 @@  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
                     if ('' !== $val) {
473
-                        $url .= $depr . $var . $depr . urlencode((string) $val);
473
+                        $url .= $depr.$var.$depr.urlencode((string) $val);
474 474
                     }
475 475
                 }
476 476
 
477
-                $url .= $suffix . $anchor;
477
+                $url .= $suffix.$anchor;
478 478
             }
479 479
         } else {
480
-            $url .= $suffix . $anchor;
480
+            $url .= $suffix.$anchor;
481 481
         }
482 482
 
483 483
         // 检测域名
484 484
         $domain = $this->parseDomain($url, $domain);
485 485
 
486 486
         // URL组装
487
-        return $domain . rtrim($this->root, '/') . '/' . ltrim($url, '/');
487
+        return $domain.rtrim($this->root, '/').'/'.ltrim($url, '/');
488 488
     }
489 489
 
490 490
     public function __toString()
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.