Completed
Push — 6.0 ( 5a666f...ae1ebf )
by liu
06:45
created
src/think/Db.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: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think;
14 14
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     public function getConfig(string $name = '', $default = null)
69 69
     {
70 70
         if ('' !== $name) {
71
-            return $this->config->get('database.' . $name, $default);
71
+            return $this->config->get('database.'.$name, $default);
72 72
         }
73 73
 
74 74
         return $this->config->get('database', []);
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     public function event(string $event, callable $callback): void
94 94
     {
95 95
         if ($this->event) {
96
-            $this->event->listen('db.' . $event, $callback);
96
+            $this->event->listen('db.'.$event, $callback);
97 97
         }
98 98
     }
99 99
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     public function trigger(string $event, $params = null, bool $once = false)
109 109
     {
110 110
         if ($this->event) {
111
-            return $this->event->trigger('db.' . $event, $params, $once);
111
+            return $this->event->trigger('db.'.$event, $params, $once);
112 112
         }
113 113
     }
114 114
 }
Please login to merge, or discard this patch.
tests/DbTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
         $config->shouldReceive('get')->with('database', [])->andReturn([]);
33 33
         $this->assertEquals([], $db->getConfig());
34 34
 
35
-        $callback = function () {
35
+        $callback = function() {
36 36
         };
37 37
         $event->shouldReceive('listen')->with('db.some', $callback);
38 38
         $db->event('some', $callback);
Please login to merge, or discard this patch.
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/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
 
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
         $this->ruleName = new RuleName();
171 171
         $this->setDefaultDomain();
172 172
 
173
-        if (is_file($this->app->getRuntimePath() . 'route.php')) {
173
+        if (is_file($this->app->getRuntimePath().'route.php')) {
174 174
             // 读取路由映射文件
175
-            $this->import(include $this->app->getRuntimePath() . 'route.php');
175
+            $this->import(include $this->app->getRuntimePath().'route.php');
176 176
         }
177 177
     }
178 178
 
@@ -402,13 +402,13 @@  discard block
 block discarded – undo
402 402
         if (is_null($domain)) {
403 403
             $domain = $this->host;
404 404
         } elseif (false === strpos($domain, '.')) {
405
-            $domain .= '.' . $this->request->rootDomain();
405
+            $domain .= '.'.$this->request->rootDomain();
406 406
         }
407 407
 
408 408
         $subDomain = $this->request->subDomain();
409 409
 
410 410
         if (strpos($subDomain, '.')) {
411
-            $name = '*' . strstr($subDomain, '.');
411
+            $name = '*'.strstr($subDomain, '.');
412 412
         }
413 413
 
414 414
         if (isset($this->bind[$domain])) {
@@ -741,9 +741,9 @@  discard block
 block discarded – undo
741 741
 
742 742
         return $this->app->middleware->pipeline()
743 743
             ->send($request)
744
-            ->then(function ($request) use ($withRoute) {
744
+            ->then(function($request) use ($withRoute) {
745 745
                 if ($withRoute) {
746
-                    $checkCallback = function () use ($withRoute) {
746
+                    $checkCallback = function() use ($withRoute) {
747 747
                         //加载路由
748 748
                         $withRoute();
749 749
                         return $this->check();
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
             $closure  = $this->config['route_check_cache_key'];
779 779
             $routeKey = $closure($request);
780 780
         } else {
781
-            $routeKey = md5($request->baseUrl(true) . ':' . $request->method());
781
+            $routeKey = md5($request->baseUrl(true).':'.$request->method());
782 782
         }
783 783
 
784 784
         return $routeKey;
@@ -828,10 +828,10 @@  discard block
 block discarded – undo
828 828
             $path = $pathinfo;
829 829
         } elseif ($suffix) {
830 830
             // 去除正常的URL后缀
831
-            $path = preg_replace('/\.(' . ltrim($suffix, '.') . ')$/i', '', $pathinfo);
831
+            $path = preg_replace('/\.('.ltrim($suffix, '.').')$/i', '', $pathinfo);
832 832
         } else {
833 833
             // 允许任何后缀访问
834
-            $path = preg_replace('/\.' . $this->request->ext() . '$/i', '', $pathinfo);
834
+            $path = preg_replace('/\.'.$this->request->ext().'$/i', '', $pathinfo);
835 835
         }
836 836
 
837 837
         return $path;
@@ -874,9 +874,9 @@  discard block
 block discarded – undo
874 874
                 $item = $this->domains[$this->host];
875 875
             } elseif (isset($this->domains[$subDomain])) {
876 876
                 $item = $this->domains[$subDomain];
877
-            } elseif (isset($this->domains['*.' . $domain2]) && !empty($domain3)) {
877
+            } elseif (isset($this->domains['*.'.$domain2]) && !empty($domain3)) {
878 878
                 // 泛三级域名
879
-                $item      = $this->domains['*.' . $domain2];
879
+                $item      = $this->domains['*.'.$domain2];
880 880
                 $panDomain = $domain3;
881 881
             } elseif (isset($this->domains['*']) && !empty($domain2)) {
882 882
                 // 泛二级域名
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   +27 added lines, -27 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
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     public function __construct(App $app)
60 60
     {
61 61
         $this->app   = $app;
62
-        $this->multi = is_dir($this->app->getBasePath() . 'controller') ? false : true;
62
+        $this->multi = is_dir($this->app->getBasePath().'controller') ? false : true;
63 63
     }
64 64
 
65 65
     /**
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
     protected function dispatchToRoute($request)
197 197
     {
198
-        $withRoute = $this->app->config->get('app.with_route', true) ? function () {
198
+        $withRoute = $this->app->config->get('app.with_route', true) ? function() {
199 199
             $this->loadRoutes();
200 200
         } : null;
201 201
 
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
      */
208 208
     protected function loadMiddleware(): void
209 209
     {
210
-        if (is_file($this->app->getBasePath() . 'middleware.php')) {
211
-            $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php');
210
+        if (is_file($this->app->getBasePath().'middleware.php')) {
211
+            $this->app->middleware->import(include $this->app->getBasePath().'middleware.php');
212 212
         }
213 213
     }
214 214
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
         $routePath = $this->getRoutePath();
224 224
 
225 225
         if (is_dir($routePath)) {
226
-            $files = glob($routePath . '*.php');
226
+            $files = glob($routePath.'*.php');
227 227
             foreach ($files as $file) {
228 228
                 include $file;
229 229
             }
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
     protected function getRoutePath(): string
241 241
     {
242 242
         if ($this->app->config->get('route.cross_app_route')) {
243
-            return $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR;
243
+            return $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR;
244 244
         }
245 245
 
246
-        if ($this->isMulti() && is_dir($this->app->getAppPath() . 'route')) {
247
-            return $this->app->getAppPath() . 'route' . DIRECTORY_SEPARATOR;
246
+        if ($this->isMulti() && is_dir($this->app->getAppPath().'route')) {
247
+            return $this->app->getAppPath().'route'.DIRECTORY_SEPARATOR;
248 248
         }
249 249
 
250
-        return $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . ($this->isMulti() ? $this->getName() . DIRECTORY_SEPARATOR : '');
250
+        return $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.($this->isMulti() ? $this->getName().DIRECTORY_SEPARATOR : '');
251 251
     }
252 252
 
253 253
     /**
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
                         $appName = $map[$name];
339 339
                     }
340 340
                 } elseif ($name && (false !== array_search($name, $map) || in_array($name, $deny))) {
341
-                    throw new HttpException(404, 'app not exists:' . $name);
341
+                    throw new HttpException(404, 'app not exists:'.$name);
342 342
                 } elseif ($name && isset($map['*'])) {
343 343
                     $appName = $map['*'];
344 344
                 } else {
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
                 }
347 347
 
348 348
                 if ($name) {
349
-                    $this->app->request->setRoot('/' . $name);
349
+                    $this->app->request->setRoot('/'.$name);
350 350
                     $this->app->request->setPathinfo(strpos($path, '/') ? ltrim(strstr($path, '/'), '/') : '');
351 351
                 }
352 352
             }
@@ -365,11 +365,11 @@  discard block
 block discarded – undo
365 365
     {
366 366
         $this->name = $appName;
367 367
         $this->app->request->setApp($appName);
368
-        $this->app->setAppPath($this->path ?: $this->app->getBasePath() . $appName . DIRECTORY_SEPARATOR);
369
-        $this->app->setRuntimePath($this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . $appName . DIRECTORY_SEPARATOR);
368
+        $this->app->setAppPath($this->path ?: $this->app->getBasePath().$appName.DIRECTORY_SEPARATOR);
369
+        $this->app->setRuntimePath($this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.$appName.DIRECTORY_SEPARATOR);
370 370
 
371 371
         // 设置应用命名空间
372
-        $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\' . $appName);
372
+        $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\'.$appName);
373 373
 
374 374
         //加载应用
375 375
         $this->loadApp($appName);
@@ -386,34 +386,34 @@  discard block
 block discarded – undo
386 386
         if (is_dir($this->app->getAppPath())) {
387 387
             $appPath = $this->app->getAppPath();
388 388
 
389
-            if (is_file($appPath . 'common.php')) {
390
-                include_once $appPath . 'common.php';
389
+            if (is_file($appPath.'common.php')) {
390
+                include_once $appPath.'common.php';
391 391
             }
392 392
 
393 393
             $configPath = $this->app->getConfigPath();
394 394
 
395 395
             $files = [];
396 396
 
397
-            if (is_dir($appPath . 'config')) {
398
-                $files = array_merge($files, glob($appPath . 'config' . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt()));
399
-            } elseif (is_dir($configPath . $appName)) {
400
-                $files = array_merge($files, glob($configPath . $appName . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt()));
397
+            if (is_dir($appPath.'config')) {
398
+                $files = array_merge($files, glob($appPath.'config'.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt()));
399
+            } elseif (is_dir($configPath.$appName)) {
400
+                $files = array_merge($files, glob($configPath.$appName.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt()));
401 401
             }
402 402
 
403 403
             foreach ($files as $file) {
404 404
                 $this->app->config->load($file, pathinfo($file, PATHINFO_FILENAME));
405 405
             }
406 406
 
407
-            if (is_file($appPath . 'event.php')) {
408
-                $this->app->loadEvent(include $appPath . 'event.php');
407
+            if (is_file($appPath.'event.php')) {
408
+                $this->app->loadEvent(include $appPath.'event.php');
409 409
             }
410 410
 
411
-            if (is_file($appPath . 'middleware.php')) {
412
-                $this->app->middleware->import(include $appPath . 'middleware.php');
411
+            if (is_file($appPath.'middleware.php')) {
412
+                $this->app->middleware->import(include $appPath.'middleware.php');
413 413
             }
414 414
 
415
-            if (is_file($appPath . 'provider.php')) {
416
-                $this->app->bind(include $appPath . 'provider.php');
415
+            if (is_file($appPath.'provider.php')) {
416
+                $this->app->bind(include $appPath.'provider.php');
417 417
             }
418 418
         }
419 419
 
Please login to merge, or discard this patch.