Completed
Push — 6.0 ( 4b767c...3d7f88 )
by liu
05:21
created
src/think/Validate.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;
14 14
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
      */
368 368
     public function hasScene(string $name): bool
369 369
     {
370
-        return isset($this->scene[$name]) || method_exists($this, 'scene' . $name);
370
+        return isset($this->scene[$name]) || method_exists($this, 'scene'.$name);
371 371
     }
372 372
 
373 373
     /**
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
             if (strpos($field, '_confirm')) {
720 720
                 $rule = strstr($field, '_confirm', true);
721 721
             } else {
722
-                $rule = $field . '_confirm';
722
+                $rule = $field.'_confirm';
723 723
             }
724 724
         }
725 725
 
@@ -870,9 +870,9 @@  discard block
 block discarded – undo
870 870
                 if (isset($this->type[$rule])) {
871 871
                     // 注册的验证规则
872 872
                     $result = call_user_func_array($this->type[$rule], [$value]);
873
-                } elseif (function_exists('ctype_' . $rule)) {
873
+                } elseif (function_exists('ctype_'.$rule)) {
874 874
                     // ctype验证规则
875
-                    $ctypeFun = 'ctype_' . $rule;
875
+                    $ctypeFun = 'ctype_'.$rule;
876 876
                     $result   = $ctypeFun($value);
877 877
                 } elseif (isset($this->filter[$rule])) {
878 878
                     // Filter_var验证规则
@@ -1510,7 +1510,7 @@  discard block
 block discarded – undo
1510 1510
 
1511 1511
         if (is_string($rule) && 0 !== strpos($rule, '/') && !preg_match('/\/[imsU]{0,4}$/', $rule)) {
1512 1512
             // 不是正则表达式则两端补上/
1513
-            $rule = '/^' . $rule . '$/';
1513
+            $rule = '/^'.$rule.'$/';
1514 1514
         }
1515 1515
 
1516 1516
         return is_scalar($value) && 1 === preg_match($rule, (string) $value);
@@ -1560,8 +1560,8 @@  discard block
 block discarded – undo
1560 1560
      */
1561 1561
     protected function getRuleMsg(string $attribute, string $title, string $type, $rule)
1562 1562
     {
1563
-        if (isset($this->message[$attribute . '.' . $type])) {
1564
-            $msg = $this->message[$attribute . '.' . $type];
1563
+        if (isset($this->message[$attribute.'.'.$type])) {
1564
+            $msg = $this->message[$attribute.'.'.$type];
1565 1565
         } elseif (isset($this->message[$attribute][$type])) {
1566 1566
             $msg = $this->message[$attribute][$type];
1567 1567
         } elseif (isset($this->message[$attribute])) {
@@ -1571,7 +1571,7 @@  discard block
 block discarded – undo
1571 1571
         } elseif (0 === strpos($type, 'require')) {
1572 1572
             $msg = $this->typeMsg['require'];
1573 1573
         } else {
1574
-            $msg = $title . $this->lang->get('not conform to the rules');
1574
+            $msg = $title.$this->lang->get('not conform to the rules');
1575 1575
         }
1576 1576
 
1577 1577
         if (is_array($msg)) {
@@ -1633,8 +1633,8 @@  discard block
 block discarded – undo
1633 1633
     {
1634 1634
         $this->only = $this->append = $this->remove = [];
1635 1635
 
1636
-        if (method_exists($this, 'scene' . $scene)) {
1637
-            call_user_func([$this, 'scene' . $scene]);
1636
+        if (method_exists($this, 'scene'.$scene)) {
1637
+            call_user_func([$this, 'scene'.$scene]);
1638 1638
         } elseif (isset($this->scene[$scene])) {
1639 1639
             // 如果设置了验证适用场景
1640 1640
             $this->only = $this->scene[$scene];
Please login to merge, or discard this patch.
tests/EventTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $this->event->bind(['foo' => 'baz']);
44 44
 
45
-        $this->event->listen('foo', function ($bar) {
45
+        $this->event->listen('foo', function($bar) {
46 46
             $this->assertEquals('bar', $bar);
47 47
         });
48 48
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
     public function testOnceEvent()
59 59
     {
60
-        $this->event->listen('AppInit', function ($bar) {
60
+        $this->event->listen('AppInit', function($bar) {
61 61
             $this->assertEquals('bar', $bar);
62 62
             return 'foo';
63 63
         });
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     {
82 82
         $listener = m::mock("overload:SomeListener", TestListener::class);
83 83
 
84
-        $listener->shouldReceive('subscribe')->andReturnUsing(function (Event $event) use ($listener) {
84
+        $listener->shouldReceive('subscribe')->andReturnUsing(function(Event $event) use ($listener) {
85 85
 
86 86
             $listener->shouldReceive('onBar')->once()->andReturnFalse();
87 87
 
Please login to merge, or discard this patch.
src/think/Event.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
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         foreach ($methods as $method) {
222 222
             $name = $method->getName();
223 223
             if (0 === strpos($name, 'on')) {
224
-                $this->listen($prefix . substr($name, 2), [$observer, $name]);
224
+                $this->listen($prefix.substr($name, 2), [$observer, $name]);
225 225
             }
226 226
         }
227 227
 
Please login to merge, or discard this patch.
src/think/filesystem/Driver.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\filesystem;
14 14
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     public function putFileAs(string $path, File $file, string $name, array $options = [])
116 116
     {
117 117
         $stream = fopen($file->getRealPath(), 'r');
118
-        $path = trim($path . '/' . $name, '/');
118
+        $path = trim($path.'/'.$name, '/');
119 119
 
120 120
         $result = $this->putStream($path, $stream, $options);
121 121
 
Please login to merge, or discard this patch.
src/think/exception/Handle.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: yunwuxin <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\exception;
14 14
 
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
                     'code'    => $this->getCode($exception),
70 70
                     'message' => $this->getMessage($exception),
71 71
                 ];
72
-                $log  = "[{$data['code']}]{$data['message']}";
72
+                $log = "[{$data['code']}]{$data['message']}";
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/Http.php 1 patch
Spacing   +23 added lines, -23 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
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     public function __construct(App $app)
58 58
     {
59 59
         $this->app   = $app;
60
-        $this->multi = is_dir($this->app->getBasePath() . 'controller') ? false : true;
60
+        $this->multi = is_dir($this->app->getBasePath().'controller') ? false : true;
61 61
     }
62 62
 
63 63
     /**
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 
194 194
     protected function dispatchToRoute($request)
195 195
     {
196
-        $withRoute = $this->app->config->get('app.with_route', true) ? function () {
196
+        $withRoute = $this->app->config->get('app.with_route', true) ? function() {
197 197
             $this->loadRoutes();
198 198
         } : null;
199 199
 
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
      */
206 206
     protected function loadMiddleware(): void
207 207
     {
208
-        if (is_file($this->app->getBasePath() . 'middleware.php')) {
209
-            $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php');
208
+        if (is_file($this->app->getBasePath().'middleware.php')) {
209
+            $this->app->middleware->import(include $this->app->getBasePath().'middleware.php');
210 210
         }
211 211
     }
212 212
 
@@ -217,17 +217,17 @@  discard block
 block discarded – undo
217 217
      */
218 218
     protected function loadRoutes(): void
219 219
     {
220
-        $routePath = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR;
220
+        $routePath = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR;
221 221
 
222 222
         if ($this->name) {
223 223
             // 加载多应用模式的具体应用路由定义
224
-            $routeFile = $routePath . $this->name . '.php';
224
+            $routeFile = $routePath.$this->name.'.php';
225 225
             if (is_file($routeFile)) {
226 226
                 include $routeFile;
227 227
             }
228 228
         } else {
229 229
             // 单应用或者未识别的多应用路由定义
230
-            $files = glob($routePath . '*.php');
230
+            $files = glob($routePath.'*.php');
231 231
             foreach ($files as $file) {
232 232
                 if ($this->isMulti()) {
233 233
                     $this->app->route->setAppName(pathinfo($file, PATHINFO_FILENAME));
@@ -327,11 +327,11 @@  discard block
 block discarded – undo
327 327
     {
328 328
         $this->name = $appName;
329 329
         $this->app->request->setApp($appName);
330
-        $this->app->setAppPath($this->path ?: $this->app->getBasePath() . $appName . DIRECTORY_SEPARATOR);
331
-        $this->app->setRuntimePath($this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . $appName . DIRECTORY_SEPARATOR);
330
+        $this->app->setAppPath($this->path ?: $this->app->getBasePath().$appName.DIRECTORY_SEPARATOR);
331
+        $this->app->setRuntimePath($this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.$appName.DIRECTORY_SEPARATOR);
332 332
 
333 333
         // 设置应用命名空间
334
-        $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\' . $appName);
334
+        $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\'.$appName);
335 335
 
336 336
         //加载应用
337 337
         $this->loadApp($appName);
@@ -348,34 +348,34 @@  discard block
 block discarded – undo
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($appPath . 'config')) {
360
-                $files = array_merge($files, glob($appPath . 'config' . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt()));
361
-            } elseif (is_dir($configPath . $appName)) {
362
-                $files = array_merge($files, glob($configPath . $appName . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt()));
359
+            if (is_dir($appPath.'config')) {
360
+                $files = array_merge($files, glob($appPath.'config'.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt()));
361
+            } elseif (is_dir($configPath.$appName)) {
362
+                $files = array_merge($files, glob($configPath.$appName.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
 
Please login to merge, or discard this patch.
src/think/route/Url.php 1 patch
Spacing   +22 added lines, -22 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
             }
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
     {
318 318
         $request = $this->app->request;
319 319
         if (is_string($allowDomain) && false === strpos($allowDomain, '.')) {
320
-            $allowDomain .= '.' . $request->rootDomain();
320
+            $allowDomain .= '.'.$request->rootDomain();
321 321
         }
322 322
 
323 323
         foreach ($rule as $item) {
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             }
336 336
 
337 337
             if (!in_array($request->port(), [80, 443])) {
338
-                $domain .= ':' . $request->port();
338
+                $domain .= ':'.$request->port();
339 339
             }
340 340
 
341 341
             if (empty($pattern)) {
@@ -346,12 +346,12 @@  discard block
 block discarded – undo
346 346
 
347 347
             foreach ($pattern as $key => $val) {
348 348
                 if (isset($vars[$key])) {
349
-                    $url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key, '<' . $key . '>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url);
349
+                    $url = str_replace(['[:'.$key.']', '<'.$key.'?>', ':'.$key, '<'.$key.'>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url);
350 350
                     unset($vars[$key]);
351 351
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
352 352
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
353 353
                 } elseif (2 == $val) {
354
-                    $url    = str_replace(['/[:' . $key . ']', '[:' . $key . ']', '<' . $key . '?>'], '', $url);
354
+                    $url    = str_replace(['/[:'.$key.']', '[:'.$key.']', '<'.$key.'?>'], '', $url);
355 355
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
356 356
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
357 357
                 } else {
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
         if (0 === strpos($url, '[') && $pos = strpos($url, ']')) {
380 380
             // [name] 表示使用路由命名标识生成URL
381 381
             $name = substr($url, 1, $pos - 1);
382
-            $url  = 'name' . substr($url, $pos + 1);
382
+            $url  = 'name'.substr($url, $pos + 1);
383 383
         }
384 384
 
385 385
         if (false === strpos($url, '://') && 0 !== strpos($url, '/')) {
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
         }
407 407
 
408 408
         if ($url) {
409
-            $checkName   = isset($name) ? $name : $url . (isset($info['query']) ? '?' . $info['query'] : '');
409
+            $checkName   = isset($name) ? $name : $url.(isset($info['query']) ? '?'.$info['query'] : '');
410 410
             $checkDomain = $domain && is_string($domain) ? $domain : null;
411 411
 
412 412
             $rule = $this->route->getName($checkName, $checkDomain);
@@ -433,10 +433,10 @@  discard block
 block discarded – undo
433 433
             }
434 434
 
435 435
             if ($request->app() && $this->app->config->get('app.auto_multi_app') && !$this->app->http->isBindDomain()) {
436
-                $url = $request->app() . '/' . $url;
436
+                $url = $request->app().'/'.$url;
437 437
             }
438 438
         } elseif (!empty($rule) && isset($name)) {
439
-            throw new \InvalidArgumentException('route name not exists:' . $name);
439
+            throw new \InvalidArgumentException('route name not exists:'.$name);
440 440
         } else {
441 441
             // 检测URL绑定
442 442
             $bind = $this->route->getDomainBind($domain && is_string($domain) ? $domain : null);
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
             $file = str_replace('\\', '/', dirname($file));
475 475
         }
476 476
 
477
-        $url = rtrim($file, '/') . '/' . $url;
477
+        $url = rtrim($file, '/').'/'.$url;
478 478
 
479 479
         // URL后缀
480 480
         if ('/' == substr($url, -1) || '' == $url) {
@@ -484,32 +484,32 @@  discard block
 block discarded – undo
484 484
         }
485 485
 
486 486
         // 锚点
487
-        $anchor = !empty($anchor) ? '#' . $anchor : '';
487
+        $anchor = !empty($anchor) ? '#'.$anchor : '';
488 488
 
489 489
         // 参数组装
490 490
         if (!empty($vars)) {
491 491
             // 添加参数
492 492
             if ($this->route->config('url_common_param')) {
493 493
                 $vars = http_build_query($vars);
494
-                $url .= $suffix . '?' . $vars . $anchor;
494
+                $url .= $suffix.'?'.$vars.$anchor;
495 495
             } else {
496 496
                 foreach ($vars as $var => $val) {
497 497
                     if ('' !== $val) {
498
-                        $url .= $depr . $var . $depr . urlencode((string) $val);
498
+                        $url .= $depr.$var.$depr.urlencode((string) $val);
499 499
                     }
500 500
                 }
501 501
 
502
-                $url .= $suffix . $anchor;
502
+                $url .= $suffix.$anchor;
503 503
             }
504 504
         } else {
505
-            $url .= $suffix . $anchor;
505
+            $url .= $suffix.$anchor;
506 506
         }
507 507
 
508 508
         // 检测域名
509 509
         $domain = $this->parseDomain($url, $domain);
510 510
 
511 511
         // URL组装
512
-        return $domain . rtrim($this->root, '/') . '/' . ltrim($url, '/');
512
+        return $domain.rtrim($this->root, '/').'/'.ltrim($url, '/');
513 513
     }
514 514
 
515 515
     public function __toString()
Please login to merge, or discard this patch.
src/think/Middleware.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: Slince <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think;
14 14
 
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
     public function pipeline(string $type = 'global')
129 129
     {
130 130
         return (new Pipeline())
131
-            ->through(array_map(function ($middleware) {
132
-                return function ($request, $next) use ($middleware) {
131
+            ->through(array_map(function($middleware) {
132
+                return function($request, $next) use ($middleware) {
133 133
                     list($call, $param) = $middleware;
134 134
                     if (is_array($call) && is_string($call[0])) {
135 135
                         $call = [$this->app->make($call[0]), $call[1]];
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     protected function sortMiddleware(array $middlewares)
227 227
     {
228 228
         $priority = $this->app->config->get('middleware.priority', []);
229
-        uasort($middlewares, function ($a, $b) use ($priority) {
229
+        uasort($middlewares, function($a, $b) use ($priority) {
230 230
             $aPriority = $this->getMiddlewarePriority($priority, $a);
231 231
             $bPriority = $this->getMiddlewarePriority($priority, $b);
232 232
             return $bPriority - $aPriority;
Please login to merge, or discard this patch.
src/think/Route.php 1 patch
Spacing   +15 added lines, -15 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
 
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
         $this->ruleName = new RuleName();
178 178
         $this->setDefaultDomain();
179 179
 
180
-        if (is_file($this->app->getRuntimePath() . 'route.php')) {
180
+        if (is_file($this->app->getRuntimePath().'route.php')) {
181 181
             // 读取路由映射文件
182
-            $this->import(include $this->app->getRuntimePath() . 'route.php');
182
+            $this->import(include $this->app->getRuntimePath().'route.php');
183 183
         }
184 184
     }
185 185
 
@@ -420,13 +420,13 @@  discard block
 block discarded – undo
420 420
         if (is_null($domain)) {
421 421
             $domain = $this->host;
422 422
         } elseif (false === strpos($domain, '.')) {
423
-            $domain .= '.' . $this->request->rootDomain();
423
+            $domain .= '.'.$this->request->rootDomain();
424 424
         }
425 425
 
426 426
         $subDomain = $this->request->subDomain();
427 427
 
428 428
         if (strpos($subDomain, '.')) {
429
-            $name = '*' . strstr($subDomain, '.');
429
+            $name = '*'.strstr($subDomain, '.');
430 430
         }
431 431
 
432 432
         if (isset($this->bind[$domain])) {
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
         $this->init();
761 761
 
762 762
         if ($withRoute) {
763
-            $checkCallback = function () use ($withRoute) {
763
+            $checkCallback = function() use ($withRoute) {
764 764
                 //加载路由
765 765
                 $withRoute();
766 766
                 return $this->check();
@@ -781,10 +781,10 @@  discard block
 block discarded – undo
781 781
 
782 782
         return $this->app->middleware->pipeline()
783 783
             ->send($request)
784
-            ->then(function ($request) use ($dispatch) {
784
+            ->then(function($request) use ($dispatch) {
785 785
                 return $this->app->middleware->pipeline('route')
786 786
                     ->send($request)
787
-                    ->then(function () use ($dispatch) {
787
+                    ->then(function() use ($dispatch) {
788 788
                         return $dispatch->run();
789 789
                     });
790 790
             });
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
             $closure  = $this->config['route_check_cache_key'];
803 803
             $routeKey = $closure($request);
804 804
         } else {
805
-            $routeKey = md5($request->baseUrl(true) . ':' . $request->method());
805
+            $routeKey = md5($request->baseUrl(true).':'.$request->method());
806 806
         }
807 807
 
808 808
         return $routeKey;
@@ -852,10 +852,10 @@  discard block
 block discarded – undo
852 852
             $path = $pathinfo;
853 853
         } elseif ($suffix) {
854 854
             // 去除正常的URL后缀
855
-            $path = preg_replace('/\.(' . ltrim($suffix, '.') . ')$/i', '', $pathinfo);
855
+            $path = preg_replace('/\.('.ltrim($suffix, '.').')$/i', '', $pathinfo);
856 856
         } else {
857 857
             // 允许任何后缀访问
858
-            $path = preg_replace('/\.' . $this->request->ext() . '$/i', '', $pathinfo);
858
+            $path = preg_replace('/\.'.$this->request->ext().'$/i', '', $pathinfo);
859 859
         }
860 860
 
861 861
         return $path;
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
                     $appName = $map[$name];
885 885
                 }
886 886
             } elseif ($name && (false !== array_search($name, $map) || in_array($name, $deny))) {
887
-                throw new HttpException(404, 'app not exists:' . $name);
887
+                throw new HttpException(404, 'app not exists:'.$name);
888 888
             } elseif ($name && isset($map['*'])) {
889 889
                 $appName = $map['*'];
890 890
             } else {
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
             }
893 893
 
894 894
             if ($name) {
895
-                $this->request->setRoot('/' . $name);
895
+                $this->request->setRoot('/'.$name);
896 896
                 $url = strpos($url, '|') ? ltrim(strstr($url, '|'), '|') : '';
897 897
                 $this->request->setPathinfo(str_replace('|', $this->config['pathinfo_depr'], $url));
898 898
             }
@@ -929,9 +929,9 @@  discard block
 block discarded – undo
929 929
                 $item = $this->domains[$this->host];
930 930
             } elseif (isset($this->domains[$subDomain])) {
931 931
                 $item = $this->domains[$subDomain];
932
-            } elseif (isset($this->domains['*.' . $domain2]) && !empty($domain3)) {
932
+            } elseif (isset($this->domains['*.'.$domain2]) && !empty($domain3)) {
933 933
                 // 泛三级域名
934
-                $item      = $this->domains['*.' . $domain2];
934
+                $item      = $this->domains['*.'.$domain2];
935 935
                 $panDomain = $domain3;
936 936
             } elseif (isset($this->domains['*']) && !empty($domain2)) {
937 937
                 // 泛二级域名
Please login to merge, or discard this patch.