Passed
Push — 6.0 ( d2dea0...4ccb3e )
by liu
06:29 queued 11s
created
src/think/route/Url.php 1 patch
Spacing   +21 added lines, -21 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
             }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
             }
333 333
 
334 334
             if (!in_array($request->port(), [80, 443])) {
335
-                $domain .= ':' . $request->port();
335
+                $domain .= ':'.$request->port();
336 336
             }
337 337
 
338 338
             if (empty($pattern)) {
@@ -343,12 +343,12 @@  discard block
 block discarded – undo
343 343
 
344 344
             foreach ($pattern as $key => $val) {
345 345
                 if (isset($vars[$key])) {
346
-                    $url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key, '<' . $key . '>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url);
346
+                    $url = str_replace(['[:'.$key.']', '<'.$key.'?>', ':'.$key, '<'.$key.'>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url);
347 347
                     unset($vars[$key]);
348 348
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
349 349
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
350 350
                 } elseif (2 == $val) {
351
-                    $url    = str_replace(['/[:' . $key . ']', '[:' . $key . ']', '<' . $key . '?>'], '', $url);
351
+                    $url    = str_replace(['/[:'.$key.']', '[:'.$key.']', '<'.$key.'?>'], '', $url);
352 352
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
353 353
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
354 354
                 } else {
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
         if (0 === strpos($url, '[') && $pos = strpos($url, ']')) {
377 377
             // [name] 表示使用路由命名标识生成URL
378 378
             $name = substr($url, 1, $pos - 1);
379
-            $url  = 'name' . substr($url, $pos + 1);
379
+            $url  = 'name'.substr($url, $pos + 1);
380 380
         }
381 381
 
382 382
         if (false === strpos($url, '://') && 0 !== strpos($url, '/')) {
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
         }
404 404
 
405 405
         if ($url) {
406
-            $checkName   = isset($name) ? $name : $url . (isset($info['query']) ? '?' . $info['query'] : '');
406
+            $checkName   = isset($name) ? $name : $url.(isset($info['query']) ? '?'.$info['query'] : '');
407 407
             $checkDomain = $domain && is_string($domain) ? $domain : null;
408 408
 
409 409
             $rule = $this->route->getName($checkName, $checkDomain);
@@ -430,10 +430,10 @@  discard block
 block discarded – undo
430 430
             }
431 431
 
432 432
             if ($request->app() && $this->app->config->get('app.auto_multi_app') && !$this->app->http->isBindDomain()) {
433
-                $url = $request->app() . '/' . $url;
433
+                $url = $request->app().'/'.$url;
434 434
             }
435 435
         } elseif (!empty($rule) && isset($name)) {
436
-            throw new \InvalidArgumentException('route name not exists:' . $name);
436
+            throw new \InvalidArgumentException('route name not exists:'.$name);
437 437
         } else {
438 438
             // 检测URL绑定
439 439
             $bind = $this->route->getDomainBind($domain && is_string($domain) ? $domain : null);
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
             $file = str_replace('\\', '/', dirname($file));
472 472
         }
473 473
 
474
-        $url = rtrim($file, '/') . '/' . $url;
474
+        $url = rtrim($file, '/').'/'.$url;
475 475
 
476 476
         // URL后缀
477 477
         if ('/' == substr($url, -1) || '' == $url) {
@@ -481,32 +481,32 @@  discard block
 block discarded – undo
481 481
         }
482 482
 
483 483
         // 锚点
484
-        $anchor = !empty($anchor) ? '#' . $anchor : '';
484
+        $anchor = !empty($anchor) ? '#'.$anchor : '';
485 485
 
486 486
         // 参数组装
487 487
         if (!empty($vars)) {
488 488
             // 添加参数
489 489
             if ($this->route->config('url_common_param')) {
490 490
                 $vars = http_build_query($vars);
491
-                $url .= $suffix . '?' . $vars . $anchor;
491
+                $url .= $suffix.'?'.$vars.$anchor;
492 492
             } else {
493 493
                 foreach ($vars as $var => $val) {
494 494
                     if ('' !== $val) {
495
-                        $url .= $depr . $var . $depr . urlencode((string) $val);
495
+                        $url .= $depr.$var.$depr.urlencode((string) $val);
496 496
                     }
497 497
                 }
498 498
 
499
-                $url .= $suffix . $anchor;
499
+                $url .= $suffix.$anchor;
500 500
             }
501 501
         } else {
502
-            $url .= $suffix . $anchor;
502
+            $url .= $suffix.$anchor;
503 503
         }
504 504
 
505 505
         // 检测域名
506 506
         $domain = $this->parseDomain($url, $domain);
507 507
 
508 508
         // URL组装
509
-        return $domain . rtrim($this->root, '/') . '/' . ltrim($url, '/');
509
+        return $domain.rtrim($this->root, '/').'/'.ltrim($url, '/');
510 510
     }
511 511
 
512 512
     public function __toString()
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
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
         if (strpos($controller, '.')) {
56 56
             $pos              = strrpos($controller, '.');
57
-            $this->controller = substr($controller, 0, $pos) . '.' . Str::studly(substr($controller, $pos + 1));
57
+            $this->controller = substr($controller, 0, $pos).'.'.Str::studly(substr($controller, $pos + 1));
58 58
         } else {
59 59
             $this->controller = Str::studly($controller);
60 60
         }
@@ -74,15 +74,15 @@  discard block
 block discarded – undo
74 74
             // 实例化控制器
75 75
             $instance = $this->controller($this->controller);
76 76
         } catch (ClassNotFoundException $e) {
77
-            throw new HttpException(404, 'controller not exists:' . $e->getClass());
77
+            throw new HttpException(404, 'controller not exists:'.$e->getClass());
78 78
         }
79 79
 
80 80
         // 注册控制器中间件
81 81
         $this->registerControllerMiddleware($instance);
82 82
 
83
-        $this->app->middleware->controller(function (Request $request, $next) use ($instance) {
83
+        $this->app->middleware->controller(function(Request $request, $next) use ($instance) {
84 84
             // 获取当前操作名
85
-            $action = $this->actionName . $this->rule->config('action_suffix');
85
+            $action = $this->actionName.$this->rule->config('action_suffix');
86 86
 
87 87
             if (is_callable([$instance, $action])) {
88 88
                 $vars = $this->request->param();
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                 }
99 99
             } else {
100 100
                 // 操作不存在
101
-                throw new HttpException(404, 'method not exists:' . get_class($instance) . '->' . $action . '()');
101
+                throw new HttpException(404, 'method not exists:'.get_class($instance).'->'.$action.'()');
102 102
             }
103 103
 
104 104
             $data = $this->app->invokeReflectMethod($instance, $reflect, $vars);
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 
128 128
             foreach ($middlewares as $key => $val) {
129 129
                 if (!is_int($key)) {
130
-                    if (isset($val['only']) && !in_array($this->request->action(true), array_map(function ($item) {
130
+                    if (isset($val['only']) && !in_array($this->request->action(true), array_map(function($item) {
131 131
                         return strtolower($item);
132 132
                     }, $val['only']))) {
133 133
                         continue;
134
-                    } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function ($item) {
134
+                    } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function($item) {
135 135
                         return strtolower($item);
136 136
                     }, $val['except']))) {
137 137
                         continue;
@@ -159,14 +159,14 @@  discard block
 block discarded – undo
159 159
         $controllerLayer = $this->rule->config('controller_layer') ?: 'controller';
160 160
         $emptyController = $this->rule->config('empty_controller') ?: 'Error';
161 161
 
162
-        $class = $this->app->parseClass($controllerLayer, $name . $suffix);
162
+        $class = $this->app->parseClass($controllerLayer, $name.$suffix);
163 163
 
164 164
         if (class_exists($class)) {
165 165
             return $this->app->make($class, [], true);
166
-        } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController . $suffix))) {
166
+        } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController.$suffix))) {
167 167
             return $this->app->make($emptyClass, [], true);
168 168
         }
169 169
 
170
-        throw new ClassNotFoundException('class not exists:' . $class, $class);
170
+        throw new ClassNotFoundException('class not exists:'.$class, $class);
171 171
     }
172 172
 }
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,14 +78,14 @@  discard block
 block discarded – undo
78 78
 
79 79
         // 模板不存在 抛出异常
80 80
         if (!is_file($template)) {
81
-            throw new TemplateNotFoundException('template not exists:' . $template, $template);
81
+            throw new TemplateNotFoundException('template not exists:'.$template, $template);
82 82
         }
83 83
 
84 84
         $this->template = $template;
85 85
 
86 86
         // 记录视图信息
87 87
         $this->app->log
88
-            ->record('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]');
88
+            ->record('[ VIEW ] '.$template.' [ '.var_export(array_keys($data), true).' ]');
89 89
 
90 90
         extract($data, EXTR_OVERWRITE);
91 91
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $this->content = $content;
105 105
 
106 106
         extract($data, EXTR_OVERWRITE);
107
-        eval('?>' . $this->content);
107
+        eval('?>'.$this->content);
108 108
     }
109 109
 
110 110
     /**
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     private function parseTemplate(string $template): string
117 117
     {
118 118
         if (empty($this->config['view_base'])) {
119
-            $this->config['view_base'] = $this->app->getRootPath() . 'view' . DIRECTORY_SEPARATOR;
119
+            $this->config['view_base'] = $this->app->getRootPath().'view'.DIRECTORY_SEPARATOR;
120 120
         }
121 121
 
122 122
         $request = $this->app->request;
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         } else {
133 133
             $app = isset($app) ? $app : $request->app();
134 134
             // 基础视图目录
135
-            $path = $this->config['view_base'] . ($app ? $app . DIRECTORY_SEPARATOR : '');
135
+            $path = $this->config['view_base'].($app ? $app.DIRECTORY_SEPARATOR : '');
136 136
         }
137 137
 
138 138
         $depr = $this->config['view_depr'];
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             $controller = $request->controller();
143 143
             if (strpos($controller, '.')) {
144 144
                 $pos        = strrpos($controller, '.');
145
-                $controller = substr($controller, 0, $pos) . '.' . Str::snake(substr($controller, $pos + 1));
145
+                $controller = substr($controller, 0, $pos).'.'.Str::snake(substr($controller, $pos + 1));
146 146
             } else {
147 147
                 $controller = Str::snake($controller);
148 148
             }
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
                         $template = App::parseName($request->action());
159 159
                     }
160 160
 
161
-                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template;
161
+                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template;
162 162
                 } elseif (false === strpos($template, $depr)) {
163
-                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template;
163
+                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template;
164 164
                 }
165 165
             }
166 166
         } else {
167 167
             $template = str_replace(['/', ':'], $depr, substr($template, 1));
168 168
         }
169 169
 
170
-        return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.');
170
+        return $path.ltrim($template, '/').'.'.ltrim($this->config['view_suffix'], '.');
171 171
     }
172 172
 
173 173
     /**
Please login to merge, or discard this patch.