Passed
Pull Request — 6.0 (#2239)
by yun
12:47 queued 06:07
created
src/think/middleware/FormTokenCheck.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: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare(strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\middleware;
14 14
 
Please login to merge, or discard this patch.
src/think/middleware/CheckRequestCache.php 1 patch
Spacing   +7 added lines, -7 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\middleware;
14 14
 
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
 
89 89
         if (isset($key) && 200 == $response->getCode() && $response->isAllowCache()) {
90 90
             $header                  = $response->getHeader();
91
-            $header['Cache-Control'] = 'max-age=' . $expire . ',must-revalidate';
92
-            $header['Last-Modified'] = gmdate('D, d M Y H:i:s') . ' GMT';
93
-            $header['Expires']       = gmdate('D, d M Y H:i:s', time() + $expire) . ' GMT';
91
+            $header['Cache-Control'] = 'max-age='.$expire.',must-revalidate';
92
+            $header['Last-Modified'] = gmdate('D, d M Y H:i:s').' GMT';
93
+            $header['Expires']       = gmdate('D, d M Y H:i:s', time() + $expire).' GMT';
94 94
 
95 95
             $this->cache->tag($tag)->set($key, [$response->getContent(), $header, time()], $expire);
96 96
         }
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
         if (false !== strpos($key, ':')) {
142 142
             $param = $request->param();
143 143
             foreach ($param as $item => $val) {
144
-                if (is_string($val) && false !== strpos($key, ':' . $item)) {
145
-                    $key = str_replace(':' . $item, $val, $key);
144
+                if (is_string($val) && false !== strpos($key, ':'.$item)) {
145
+                    $key = str_replace(':'.$item, $val, $key);
146 146
                 }
147 147
             }
148 148
         } elseif (strpos($key, ']')) {
149
-            if ('[' . $request->ext() . ']' == $key) {
149
+            if ('['.$request->ext().']' == $key) {
150 150
                 // 缓存某个后缀的请求
151 151
                 $key = md5($request->url());
152 152
             } else {
Please login to merge, or discard this patch.
src/think/App.php 1 patch
Spacing   +26 added lines, -26 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
 
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
      */
163 163
     public function __construct(string $rootPath = '')
164 164
     {
165
-        $this->thinkPath   = dirname(__DIR__) . DIRECTORY_SEPARATOR;
166
-        $this->rootPath    = $rootPath ? rtrim($rootPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : $this->getDefaultRootPath();
167
-        $this->appPath     = $this->rootPath . 'app' . DIRECTORY_SEPARATOR;
168
-        $this->runtimePath = $this->rootPath . 'runtime' . DIRECTORY_SEPARATOR;
165
+        $this->thinkPath   = dirname(__DIR__).DIRECTORY_SEPARATOR;
166
+        $this->rootPath    = $rootPath ? rtrim($rootPath, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR : $this->getDefaultRootPath();
167
+        $this->appPath     = $this->rootPath.'app'.DIRECTORY_SEPARATOR;
168
+        $this->runtimePath = $this->rootPath.'runtime'.DIRECTORY_SEPARATOR;
169 169
 
170
-        if (is_file($this->appPath . 'provider.php')) {
171
-            $this->bind(include $this->appPath . 'provider.php');
170
+        if (is_file($this->appPath.'provider.php')) {
171
+            $this->bind(include $this->appPath.'provider.php');
172 172
         }
173 173
 
174 174
         static::setInstance($this);
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
     public function getService($service)
229 229
     {
230 230
         $name = is_string($service) ? $service : get_class($service);
231
-        return array_values(array_filter($this->services, function ($value) use ($name) {
231
+        return array_values(array_filter($this->services, function($value) use ($name) {
232 232
             return $value instanceof $name;
233 233
         }, ARRAY_FILTER_USE_BOTH))[0] ?? null;
234 234
     }
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      */
305 305
     public function getBasePath(): string
306 306
     {
307
-        return $this->rootPath . 'app' . DIRECTORY_SEPARATOR;
307
+        return $this->rootPath.'app'.DIRECTORY_SEPARATOR;
308 308
     }
309 309
 
310 310
     /**
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
      */
363 363
     public function getConfigPath(): string
364 364
     {
365
-        return $this->rootPath . 'config' . DIRECTORY_SEPARATOR;
365
+        return $this->rootPath.'config'.DIRECTORY_SEPARATOR;
366 366
     }
367 367
 
368 368
     /**
@@ -408,8 +408,8 @@  discard block
 block discarded – undo
408 408
         $this->beginMem  = memory_get_usage();
409 409
 
410 410
         // 加载环境变量
411
-        if (is_file($this->rootPath . '.env')) {
412
-            $this->env->load($this->rootPath . '.env');
411
+        if (is_file($this->rootPath.'.env')) {
412
+            $this->env->load($this->rootPath.'.env');
413 413
         }
414 414
 
415 415
         $this->configExt = $this->env->get('config_ext', '.php');
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
         // 加载框架默认语言包
423 423
         $langSet = $this->lang->defaultLangSet();
424 424
 
425
-        $this->lang->load($this->thinkPath . 'lang' . DIRECTORY_SEPARATOR . $langSet . '.php');
425
+        $this->lang->load($this->thinkPath.'lang'.DIRECTORY_SEPARATOR.$langSet.'.php');
426 426
 
427 427
         // 加载应用默认语言包
428 428
         $this->loadLangPack($langSet);
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
         }
462 462
 
463 463
         // 加载系统语言包
464
-        $files = glob($this->appPath . 'lang' . DIRECTORY_SEPARATOR . $langset . '.*');
464
+        $files = glob($this->appPath.'lang'.DIRECTORY_SEPARATOR.$langset.'.*');
465 465
         $this->lang->load($files);
466 466
 
467 467
         // 加载扩展(自定义)语言包
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
      */
480 480
     public function boot(): void
481 481
     {
482
-        array_walk($this->services, function ($service) {
482
+        array_walk($this->services, function($service) {
483 483
             $this->bootService($service);
484 484
         });
485 485
     }
@@ -493,30 +493,30 @@  discard block
 block discarded – undo
493 493
     {
494 494
         $appPath = $this->getAppPath();
495 495
 
496
-        if (is_file($appPath . 'common.php')) {
497
-            include_once $appPath . 'common.php';
496
+        if (is_file($appPath.'common.php')) {
497
+            include_once $appPath.'common.php';
498 498
         }
499 499
 
500
-        include_once $this->thinkPath . 'helper.php';
500
+        include_once $this->thinkPath.'helper.php';
501 501
 
502 502
         $configPath = $this->getConfigPath();
503 503
 
504 504
         $files = [];
505 505
 
506 506
         if (is_dir($configPath)) {
507
-            $files = glob($configPath . '*' . $this->configExt);
507
+            $files = glob($configPath.'*'.$this->configExt);
508 508
         }
509 509
 
510 510
         foreach ($files as $file) {
511 511
             $this->config->load($file, pathinfo($file, PATHINFO_FILENAME));
512 512
         }
513 513
 
514
-        if (is_file($appPath . 'event.php')) {
515
-            $this->loadEvent(include $appPath . 'event.php');
514
+        if (is_file($appPath.'event.php')) {
515
+            $this->loadEvent(include $appPath.'event.php');
516 516
         }
517 517
 
518
-        if (is_file($appPath . 'service.php')) {
519
-            $services = include $appPath . 'service.php';
518
+        if (is_file($appPath.'service.php')) {
519
+            $services = include $appPath.'service.php';
520 520
             foreach ($services as $service) {
521 521
                 $this->register($service);
522 522
             }
@@ -581,9 +581,9 @@  discard block
 block discarded – undo
581 581
         $name  = str_replace(['/', '.'], '\\', $name);
582 582
         $array = explode('\\', $name);
583 583
         $class = Str::studly(array_pop($array));
584
-        $path  = $array ? implode('\\', $array) . '\\' : '';
584
+        $path  = $array ? implode('\\', $array).'\\' : '';
585 585
 
586
-        return $this->namespace . '\\' . $layer . '\\' . $path . $class;
586
+        return $this->namespace.'\\'.$layer.'\\'.$path.$class;
587 587
     }
588 588
 
589 589
     /**
@@ -602,6 +602,6 @@  discard block
 block discarded – undo
602 602
      */
603 603
     protected function getDefaultRootPath(): string
604 604
     {
605
-        return dirname($this->thinkPath, 4) . DIRECTORY_SEPARATOR;
605
+        return dirname($this->thinkPath, 4).DIRECTORY_SEPARATOR;
606 606
     }
607 607
 }
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
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
         // 模板不存在 抛出异常
80 80
         if (!is_file($template)) {
81
-            throw new RuntimeException('template not exists:' . $template);
81
+            throw new RuntimeException('template not exists:'.$template);
82 82
         }
83 83
 
84 84
         $this->template = $template;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $this->content = $content;
101 101
 
102 102
         extract($data, EXTR_OVERWRITE);
103
-        eval('?>' . $this->content);
103
+        eval('?>'.$this->content);
104 104
     }
105 105
 
106 106
     /**
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
             $appName = isset($app) ? $app : $this->app->http->getName();
126 126
             $view    = $this->config['view_dir_name'];
127 127
 
128
-            if (is_dir($this->app->getAppPath() . $view)) {
129
-                $path = isset($app) ? $this->app->getBasePath() . ($appName ? $appName . DIRECTORY_SEPARATOR : '') . $view . DIRECTORY_SEPARATOR : $this->app->getAppPath() . $view . DIRECTORY_SEPARATOR;
128
+            if (is_dir($this->app->getAppPath().$view)) {
129
+                $path = isset($app) ? $this->app->getBasePath().($appName ? $appName.DIRECTORY_SEPARATOR : '').$view.DIRECTORY_SEPARATOR : $this->app->getAppPath().$view.DIRECTORY_SEPARATOR;
130 130
             } else {
131
-                $path = $this->app->getRootPath() . $view . DIRECTORY_SEPARATOR . ($appName ? $appName . DIRECTORY_SEPARATOR : '');
131
+                $path = $this->app->getRootPath().$view.DIRECTORY_SEPARATOR.($appName ? $appName.DIRECTORY_SEPARATOR : '');
132 132
             }
133 133
         }
134 134
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
             $controller = $request->controller();
140 140
             if (strpos($controller, '.')) {
141 141
                 $pos        = strrpos($controller, '.');
142
-                $controller = substr($controller, 0, $pos) . '.' . Str::snake(substr($controller, $pos + 1));
142
+                $controller = substr($controller, 0, $pos).'.'.Str::snake(substr($controller, $pos + 1));
143 143
             } else {
144 144
                 $controller = Str::snake($controller);
145 145
             }
@@ -155,16 +155,16 @@  discard block
 block discarded – undo
155 155
                         $template = Str::snake($request->action());
156 156
                     }
157 157
 
158
-                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template;
158
+                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template;
159 159
                 } elseif (false === strpos($template, $depr)) {
160
-                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template;
160
+                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template;
161 161
                 }
162 162
             }
163 163
         } else {
164 164
             $template = str_replace(['/', ':'], $depr, substr($template, 1));
165 165
         }
166 166
 
167
-        return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.');
167
+        return $path.ltrim($template, '/').'.'.ltrim($this->config['view_suffix'], '.');
168 168
     }
169 169
 
170 170
     /**
Please login to merge, or discard this patch.
src/think/Service.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: yunwuxin <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare(strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think;
14 14
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      */
37 37
     protected function loadRoutesFrom($path)
38 38
     {
39
-        $this->registerRoutes(function () use ($path) {
39
+        $this->registerRoutes(function() use ($path) {
40 40
             include $path;
41 41
         });
42 42
     }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     {
60 60
         $commands = is_array($commands) ? $commands : func_get_args();
61 61
 
62
-        Console::starting(function (Console $console) use ($commands) {
62
+        Console::starting(function(Console $console) use ($commands) {
63 63
             $console->addCommands($commands);
64 64
         });
65 65
     }
Please login to merge, or discard this patch.
src/think/View.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
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      */
86 86
     public function fetch(string $template = '', array $vars = []): string
87 87
     {
88
-        return $this->getContent(function () use ($vars, $template) {
88
+        return $this->getContent(function() use ($vars, $template) {
89 89
             $this->engine()->fetch($template, array_merge($this->data, $vars));
90 90
         });
91 91
     }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function display(string $content, array $vars = []): string
101 101
     {
102
-        return $this->getContent(function () use ($vars, $content) {
102
+        return $this->getContent(function() use ($vars, $content) {
103 103
             $this->engine()->display($content, array_merge($this->data, $vars));
104 104
         });
105 105
     }
Please login to merge, or discard this patch.
src/think/log/Channel.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\log;
14 14
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         if (is_string($msg) && !empty($context)) {
87 87
             $replace = [];
88 88
             foreach ($context as $key => $val) {
89
-                $replace['{' . $key . '}'] = $val;
89
+                $replace['{'.$key.'}'] = $val;
90 90
             }
91 91
 
92 92
             $msg = strtr($msg, $replace);
Please login to merge, or discard this patch.
src/think/log/ChannelSet.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\log;
14 14
 
Please login to merge, or discard this patch.
src/think/log/driver/Socket.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: luofei614 <weibo.com/luofei614>
10 10
 // +----------------------------------------------------------------------
11
-declare(strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\log\driver;
14 14
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             if ($this->app->exists('request')) {
93 93
                 $currentUri = $this->app->request->url(true);
94 94
             } else {
95
-                $currentUri = 'cmd:' . implode(' ', $_SERVER['argv'] ?? []);
95
+                $currentUri = 'cmd:'.implode(' ', $_SERVER['argv'] ?? []);
96 96
             }
97 97
 
98 98
             if (!empty($this->config['format_head'])) {
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         foreach ($log as $type => $val) {
117 117
             $trace[] = [
118 118
                 'type' => isset($expandLevel[$type]) ? 'group' : 'groupCollapsed',
119
-                'msg'  => '[ ' . $type . ' ]',
119
+                'msg'  => '[ '.$type.' ]',
120 120
                 'css'  => $this->css[$type] ?? '',
121 121
             ];
122 122
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         ];
203 203
 
204 204
         $msg     = json_encode($logs, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR);
205
-        $address = '/' . $clientId; //将client_id作为地址, server端通过地址判断将日志发布给谁
205
+        $address = '/'.$clientId; //将client_id作为地址, server端通过地址判断将日志发布给谁
206 206
 
207 207
         $this->send($this->config['host'], $this->config['port'], $msg, $address);
208 208
     }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      */
286 286
     protected function send($host, $port, $message = '', $address = '/')
287 287
     {
288
-        $url = 'http://' . $host . ':' . $port . $address;
288
+        $url = 'http://'.$host.':'.$port.$address;
289 289
         $ch  = curl_init();
290 290
 
291 291
         curl_setopt($ch, CURLOPT_URL, $url);
Please login to merge, or discard this patch.