Completed
Push — 6.0 ( f89fe9...a4fe5c )
by liu
04:11
created
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
 
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
             }
183 183
         }
184 184
 
185
-        if (is_file($this->app->getRuntimePath() . 'route.php')) {
185
+        if (is_file($this->app->getRuntimePath().'route.php')) {
186 186
             // 读取路由映射文件
187
-            $this->import(include $this->app->getRuntimePath() . 'route.php');
187
+            $this->import(include $this->app->getRuntimePath().'route.php');
188 188
         }
189 189
     }
190 190
 
@@ -397,13 +397,13 @@  discard block
 block discarded – undo
397 397
         if (is_null($domain)) {
398 398
             $domain = $this->host;
399 399
         } elseif (false === strpos($domain, '.')) {
400
-            $domain .= '.' . $this->request->rootDomain();
400
+            $domain .= '.'.$this->request->rootDomain();
401 401
         }
402 402
 
403 403
         $subDomain = $this->request->subDomain();
404 404
 
405 405
         if (strpos($subDomain, '.')) {
406
-            $name = '*' . strstr($subDomain, '.');
406
+            $name = '*'.strstr($subDomain, '.');
407 407
         }
408 408
 
409 409
         if (isset($this->bind[$domain])) {
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
         $this->init();
723 723
 
724 724
         if ($withRoute) {
725
-            $checkCallback = function () use ($request, $withRoute) {
725
+            $checkCallback = function() use ($request, $withRoute) {
726 726
                 //加载路由
727 727
                 $withRoute();
728 728
                 return $this->check();
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 
742 742
         $dispatch->init($this->app);
743 743
 
744
-        $this->app->middleware->add(function () use ($dispatch) {
744
+        $this->app->middleware->add(function() use ($dispatch) {
745 745
             try {
746 746
                 $response = $dispatch->run();
747 747
             } catch (HttpResponseException $exception) {
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
             $closure  = $this->config['route_check_cache_key'];
766 766
             $routeKey = $closure($request);
767 767
         } else {
768
-            $routeKey = md5($request->baseUrl(true) . ':' . $request->method());
768
+            $routeKey = md5($request->baseUrl(true).':'.$request->method());
769 769
         }
770 770
 
771 771
         return $routeKey;
@@ -815,10 +815,10 @@  discard block
 block discarded – undo
815 815
             $path = $pathinfo;
816 816
         } elseif ($suffix) {
817 817
             // 去除正常的URL后缀
818
-            $path = preg_replace('/\.(' . ltrim($suffix, '.') . ')$/i', '', $pathinfo);
818
+            $path = preg_replace('/\.('.ltrim($suffix, '.').')$/i', '', $pathinfo);
819 819
         } else {
820 820
             // 允许任何后缀访问
821
-            $path = preg_replace('/\.' . $this->request->ext() . '$/i', '', $pathinfo);
821
+            $path = preg_replace('/\.'.$this->request->ext().'$/i', '', $pathinfo);
822 822
         }
823 823
 
824 824
         return $path;
@@ -861,9 +861,9 @@  discard block
 block discarded – undo
861 861
                 $item = $this->domains[$this->host];
862 862
             } elseif (isset($this->domains[$subDomain])) {
863 863
                 $item = $this->domains[$subDomain];
864
-            } elseif (isset($this->domains['*.' . $domain2]) && !empty($domain3)) {
864
+            } elseif (isset($this->domains['*.'.$domain2]) && !empty($domain3)) {
865 865
                 // 泛三级域名
866
-                $item      = $this->domains['*.' . $domain2];
866
+                $item      = $this->domains['*.'.$domain2];
867 867
                 $panDomain = $domain3;
868 868
             } elseif (isset($this->domains['*']) && !empty($domain2)) {
869 869
                 // 泛二级域名
Please login to merge, or discard this patch.
src/think/Console.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 // +----------------------------------------------------------------------
7 7
 // | Author: zhangyajun <[email protected]>
8 8
 // +----------------------------------------------------------------------
9
-declare (strict_types = 1);
9
+declare(strict_types=1);
10 10
 
11 11
 namespace think;
12 12
 
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
     public function findNamespace(string $namespace): string
470 470
     {
471 471
         $allNamespaces = $this->getNamespaces();
472
-        $expr          = preg_replace_callback('{([^:]+|)}', function ($matches) {
473
-            return preg_quote($matches[1]) . '[^:]*';
472
+        $expr          = preg_replace_callback('{([^:]+|)}', function($matches) {
473
+            return preg_quote($matches[1]).'[^:]*';
474 474
         }, $namespace);
475
-        $namespaces = preg_grep('{^' . $expr . '}', $allNamespaces);
475
+        $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
476 476
 
477 477
         if (empty($namespaces)) {
478 478
             $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
@@ -509,13 +509,13 @@  discard block
 block discarded – undo
509 509
     {
510 510
         $allCommands = array_keys($this->commands);
511 511
 
512
-        $expr = preg_replace_callback('{([^:]+|)}', function ($matches) {
513
-            return preg_quote($matches[1]) . '[^:]*';
512
+        $expr = preg_replace_callback('{([^:]+|)}', function($matches) {
513
+            return preg_quote($matches[1]).'[^:]*';
514 514
         }, $name);
515 515
 
516
-        $commands = preg_grep('{^' . $expr . '}', $allCommands);
516
+        $commands = preg_grep('{^'.$expr.'}', $allCommands);
517 517
 
518
-        if (empty($commands) || count(preg_grep('{^' . $expr . '$}', $commands)) < 1) {
518
+        if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
519 519
             if (false !== $pos = strrpos($name, ':')) {
520 520
                 $this->findNamespace(substr($name, 0, $pos));
521 521
             }
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
             }
710 710
         }
711 711
 
712
-        $alternatives = array_filter($alternatives, function ($lev) use ($threshold) {
712
+        $alternatives = array_filter($alternatives, function($lev) use ($threshold) {
713 713
             return $lev < 2 * $threshold;
714 714
         });
715 715
         asort($alternatives);
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 
731 731
         foreach ($parts as $part) {
732 732
             if (count($namespaces)) {
733
-                $namespaces[] = end($namespaces) . ':' . $part;
733
+                $namespaces[] = end($namespaces).':'.$part;
734 734
             } else {
735 735
                 $namespaces[] = $part;
736 736
             }
Please login to merge, or discard this patch.
src/think/Http.php 1 patch
Spacing   +25 added lines, -25 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
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     public function __construct(App $app)
56 56
     {
57 57
         $this->app   = $app;
58
-        $this->multi = is_dir($this->app->getBasePath() . 'controller') ? false : true;
58
+        $this->multi = is_dir($this->app->getBasePath().'controller') ? false : true;
59 59
     }
60 60
 
61 61
     /**
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
         $this->initialize();
172 172
 
173 173
         // 加载全局中间件
174
-        if (is_file($this->app->getBasePath() . 'middleware.php')) {
175
-            $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php');
174
+        if (is_file($this->app->getBasePath().'middleware.php')) {
175
+            $this->app->middleware->import(include $this->app->getBasePath().'middleware.php');
176 176
         }
177 177
 
178 178
         if ($this->multi) {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         // 监听HttpRun
186 186
         $this->app->event->trigger('HttpRun');
187 187
 
188
-        $withRoute = $this->app->config->get('app.with_route', true) ? function () {
188
+        $withRoute = $this->app->config->get('app.with_route', true) ? function() {
189 189
             $this->loadRoutes();
190 190
         } : null;
191 191
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
     {
202 202
         // 加载路由定义
203 203
         if (is_dir($this->getRoutePath())) {
204
-            $files = glob($this->getRoutePath() . '*.php');
204
+            $files = glob($this->getRoutePath().'*.php');
205 205
             foreach ($files as $file) {
206 206
                 include $file;
207 207
             }
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
                 $this->app->console->call('route:build', [$this->name]);
214 214
             }
215 215
 
216
-            $filename = $this->app->getRuntimePath() . 'build_route.php';
216
+            $filename = $this->app->getRuntimePath().'build_route.php';
217 217
 
218 218
             if (is_file($filename)) {
219 219
                 include $filename;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
      */
229 229
     protected function getRoutePath(): string
230 230
     {
231
-        return $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . ($this->isMulti() ? $this->getName() . DIRECTORY_SEPARATOR : '');
231
+        return $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.($this->isMulti() ? $this->getName().DIRECTORY_SEPARATOR : '');
232 232
     }
233 233
 
234 234
     /**
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
                         $appName = $map[$name];
314 314
                     }
315 315
                 } elseif ($name && (false !== array_search($name, $map) || in_array($name, $deny))) {
316
-                    throw new HttpException(404, 'app not exists:' . $name);
316
+                    throw new HttpException(404, 'app not exists:'.$name);
317 317
                 } elseif ($name && isset($map['*'])) {
318 318
                     $appName = $map['*'];
319 319
                 } else {
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
                 }
322 322
 
323 323
                 if ($name) {
324
-                    $this->app->request->setRoot('/' . $name);
324
+                    $this->app->request->setRoot('/'.$name);
325 325
                     $this->app->request->setPathinfo(strpos($path, '/') ? ltrim(strstr($path, '/'), '/') : '');
326 326
                 }
327 327
             }
@@ -341,41 +341,41 @@  discard block
 block discarded – undo
341 341
     {
342 342
         $this->name = $appName;
343 343
         $this->app->request->setApp($appName);
344
-        $this->app->setAppPath($this->path ?: $this->app->getBasePath() . $appName . DIRECTORY_SEPARATOR);
345
-        $this->app->setRuntimePath($this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . $appName . DIRECTORY_SEPARATOR);
344
+        $this->app->setAppPath($this->path ?: $this->app->getBasePath().$appName.DIRECTORY_SEPARATOR);
345
+        $this->app->setRuntimePath($this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.$appName.DIRECTORY_SEPARATOR);
346 346
 
347 347
         //加载app文件
348 348
         if (is_dir($this->app->getAppPath())) {
349 349
             $appPath = $this->app->getAppPath();
350 350
 
351
-            if (is_file($appPath . 'common.php')) {
352
-                include_once $appPath . 'common.php';
351
+            if (is_file($appPath.'common.php')) {
352
+                include_once $appPath.'common.php';
353 353
             }
354 354
 
355 355
             $configPath = $this->app->getConfigPath();
356 356
 
357 357
             $files = [];
358 358
 
359
-            if (is_dir($configPath . $appName)) {
360
-                $files = array_merge($files, glob($configPath . $appName . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt()));
361
-            } elseif (is_dir($appPath . 'config')) {
362
-                $files = array_merge($files, glob($appPath . 'config' . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt()));
359
+            if (is_dir($configPath.$appName)) {
360
+                $files = array_merge($files, glob($configPath.$appName.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt()));
361
+            } elseif (is_dir($appPath.'config')) {
362
+                $files = array_merge($files, glob($appPath.'config'.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt()));
363 363
             }
364 364
 
365 365
             foreach ($files as $file) {
366 366
                 $this->app->config->load($file, pathinfo($file, PATHINFO_FILENAME));
367 367
             }
368 368
 
369
-            if (is_file($appPath . 'event.php')) {
370
-                $this->app->loadEvent(include $appPath . 'event.php');
369
+            if (is_file($appPath.'event.php')) {
370
+                $this->app->loadEvent(include $appPath.'event.php');
371 371
             }
372 372
 
373
-            if (is_file($appPath . 'middleware.php')) {
374
-                $this->app->middleware->import(include $appPath . 'middleware.php');
373
+            if (is_file($appPath.'middleware.php')) {
374
+                $this->app->middleware->import(include $appPath.'middleware.php');
375 375
             }
376 376
 
377
-            if (is_file($appPath . 'provider.php')) {
378
-                $this->app->bind(include $appPath . 'provider.php');
377
+            if (is_file($appPath.'provider.php')) {
378
+                $this->app->bind(include $appPath.'provider.php');
379 379
             }
380 380
         }
381 381
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
         $this->app->loadLangPack($this->app->lang->defaultLangSet());
384 384
 
385 385
         // 设置应用命名空间
386
-        $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\' . $appName);
386
+        $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\'.$appName);
387 387
     }
388 388
 
389 389
     /**
Please login to merge, or discard this patch.
src/think/Session.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
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
             $this->data = $data;
388 388
         }
389 389
 
390
-        $sessionId = md5(microtime(true) . uniqid());
390
+        $sessionId = md5(microtime(true).uniqid());
391 391
 
392 392
         $this->setId($sessionId);
393 393
         return $sessionId;
Please login to merge, or discard this patch.
src/think/Config.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
     {
65 65
         if (is_file($file)) {
66 66
             $filename = $file;
67
-        } elseif (is_file($this->path . $file . $this->ext)) {
68
-            $filename = $this->path . $file . $this->ext;
67
+        } elseif (is_file($this->path.$file.$this->ext)) {
68
+            $filename = $this->path.$file.$this->ext;
69 69
         }
70 70
 
71 71
         if (isset($filename)) {
Please login to merge, or discard this patch.
src/think/filesystem/CacheStore.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 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
 
Please login to merge, or discard this patch.
src/think/filesystem/Driver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
         $stream = fopen($file->getRealPath(), 'r');
87 87
 
88 88
         $result = $this->putStream(
89
-            $path = trim($path . '/' . $name, '/'), $stream, $options
89
+            $path = trim($path.'/'.$name, '/'), $stream, $options
90 90
         );
91 91
 
92 92
         if (is_resource($stream)) {
Please login to merge, or discard this patch.
src/think/view/driver/Php.php 1 patch
Spacing   +10 added lines, -10 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\view\driver;
14 14
 
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
 
78 78
         // 模板不存在 抛出异常
79 79
         if (!is_file($template)) {
80
-            throw new TemplateNotFoundException('template not exists:' . $template, $template);
80
+            throw new TemplateNotFoundException('template not exists:'.$template, $template);
81 81
         }
82 82
 
83 83
         $this->template = $template;
84 84
 
85 85
         // 记录视图信息
86 86
         $this->app->log
87
-            ->record('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]');
87
+            ->record('[ VIEW ] '.$template.' [ '.var_export(array_keys($data), true).' ]');
88 88
 
89 89
         extract($data, EXTR_OVERWRITE);
90 90
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         $this->content = $content;
104 104
 
105 105
         extract($data, EXTR_OVERWRITE);
106
-        eval('?>' . $this->content);
106
+        eval('?>'.$this->content);
107 107
     }
108 108
 
109 109
     /**
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     private function parseTemplate(string $template): string
116 116
     {
117 117
         if (empty($this->config['view_path'])) {
118
-            $this->config['view_path'] = $this->app->getAppPath() . 'view' . DIRECTORY_SEPARATOR;
118
+            $this->config['view_path'] = $this->app->getAppPath().'view'.DIRECTORY_SEPARATOR;
119 119
         }
120 120
 
121 121
         $request = $this->app->request;
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
         if ($this->config['view_base']) {
130 130
             // 基础视图目录
131 131
             $app  = isset($app) ? $app : $request->app();
132
-            $path = $this->config['view_base'] . ($app ? $app . DIRECTORY_SEPARATOR : '');
132
+            $path = $this->config['view_base'].($app ? $app.DIRECTORY_SEPARATOR : '');
133 133
         } else {
134
-            $path = isset($app) ? $this->app->getBasePath() . $app . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR : $this->config['view_path'];
134
+            $path = isset($app) ? $this->app->getBasePath().$app.DIRECTORY_SEPARATOR.'view'.DIRECTORY_SEPARATOR : $this->config['view_path'];
135 135
         }
136 136
 
137 137
         $depr = $this->config['view_depr'];
@@ -151,16 +151,16 @@  discard block
 block discarded – undo
151 151
                         $template = App::parseName($request->action());
152 152
                     }
153 153
 
154
-                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template;
154
+                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template;
155 155
                 } elseif (false === strpos($template, $depr)) {
156
-                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template;
156
+                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template;
157 157
                 }
158 158
             }
159 159
         } else {
160 160
             $template = str_replace(['/', ':'], $depr, substr($template, 1));
161 161
         }
162 162
 
163
-        return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.');
163
+        return $path.ltrim($template, '/').'.'.ltrim($this->config['view_suffix'], '.');
164 164
     }
165 165
 
166 166
     /**
Please login to merge, or discard this patch.
src/think/facade/Console.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 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\facade;
14 14
 
Please login to merge, or discard this patch.