Completed
Push — 6.0 ( 594042...dcc589 )
by yun
04:09
created
src/think/View.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;
14 14
 
Please login to merge, or discard this patch.
src/think/paginator/driver/Bootstrap.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      */
140 140
     protected function getAvailablePageWrapper(string $url, string $page): string
141 141
     {
142
-        return '<li><a href="' . htmlentities($url) . '">' . $page . '</a></li>';
142
+        return '<li><a href="'.htmlentities($url).'">'.$page.'</a></li>';
143 143
     }
144 144
 
145 145
     /**
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      */
151 151
     protected function getDisabledTextWrapper(string $text): string
152 152
     {
153
-        return '<li class="disabled"><span>' . $text . '</span></li>';
153
+        return '<li class="disabled"><span>'.$text.'</span></li>';
154 154
     }
155 155
 
156 156
     /**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      */
162 162
     protected function getActivePageWrapper(string $text): string
163 163
     {
164
-        return '<li class="active"><span>' . $text . '</span></li>';
164
+        return '<li class="active"><span>'.$text.'</span></li>';
165 165
     }
166 166
 
167 167
     /**
Please login to merge, or discard this patch.
src/think/File.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: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think;
14 14
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     {
87 87
         $target = $this->getTargetFile($directory, $name);
88 88
 
89
-        set_error_handler(function ($type, $msg) use (&$error) {
89
+        set_error_handler(function($type, $msg) use (&$error) {
90 90
             $error = $msg;
91 91
         });
92 92
         $renamed = rename($this->getPathname(), $target);
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
             throw new FileException(sprintf('Unable to write in the "%s" directory', $directory));
117 117
         }
118 118
 
119
-        $target = rtrim($directory, '/\\') . \DIRECTORY_SEPARATOR . (null === $name ? $this->getBasename() : $this->getName($name));
119
+        $target = rtrim($directory, '/\\').\DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name));
120 120
 
121 121
         return new self($target, false);
122 122
     }
@@ -159,18 +159,18 @@  discard block
 block discarded – undo
159 159
                 switch (true) {
160 160
                     case in_array($rule, hash_algos()):
161 161
                         $hash           = $this->hash($rule);
162
-                        $this->hashName = substr($hash, 0, 2) . DIRECTORY_SEPARATOR . substr($hash, 2);
162
+                        $this->hashName = substr($hash, 0, 2).DIRECTORY_SEPARATOR.substr($hash, 2);
163 163
                         break;
164 164
                     case is_callable($rule):
165 165
                         $this->hashName = call_user_func($rule);
166 166
                         break;
167 167
                     default:
168
-                        $this->hashName = date('Ymd') . DIRECTORY_SEPARATOR . md5((string) microtime(true));
168
+                        $this->hashName = date('Ymd').DIRECTORY_SEPARATOR.md5((string) microtime(true));
169 169
                         break;
170 170
                 }
171 171
             }
172 172
         }
173 173
 
174
-        return $this->hashName . '.' . $this->extension();
174
+        return $this->hashName.'.'.$this->extension();
175 175
     }
176 176
 }
Please login to merge, or discard this patch.
src/think/Filesystem.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;
14 14
 
Please login to merge, or discard this patch.
src/think/App.php 1 patch
Spacing   +29 added lines, -29 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
 
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function __construct(string $rootPath = '')
110 110
     {
111
-        $this->thinkPath   = dirname(__DIR__) . DIRECTORY_SEPARATOR;
112
-        $this->rootPath    = $rootPath ? rtrim($rootPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : $this->getDefaultRootPath();
113
-        $this->appPath     = $this->rootPath . 'app' . DIRECTORY_SEPARATOR;
114
-        $this->runtimePath = $this->rootPath . 'runtime' . DIRECTORY_SEPARATOR;
111
+        $this->thinkPath   = dirname(__DIR__).DIRECTORY_SEPARATOR;
112
+        $this->rootPath    = $rootPath ? rtrim($rootPath, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR : $this->getDefaultRootPath();
113
+        $this->appPath     = $this->rootPath.'app'.DIRECTORY_SEPARATOR;
114
+        $this->runtimePath = $this->rootPath.'runtime'.DIRECTORY_SEPARATOR;
115 115
 
116
-        if (is_file($this->appPath . 'provider.php')) {
117
-            $this->bind(include $this->appPath . 'provider.php');
116
+        if (is_file($this->appPath.'provider.php')) {
117
+            $this->bind(include $this->appPath.'provider.php');
118 118
         }
119 119
 
120 120
         static::setInstance($this);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     public function getService($service)
175 175
     {
176 176
         $name = is_string($service) ? $service : get_class($service);
177
-        return array_values(array_filter($this->services, function ($value) use ($name) {
177
+        return array_values(array_filter($this->services, function($value) use ($name) {
178 178
             return $value instanceof $name;
179 179
         }, ARRAY_FILTER_USE_BOTH))[0] ?? null;
180 180
     }
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
      */
251 251
     public function getBasePath(): string
252 252
     {
253
-        return $this->rootPath . 'app' . DIRECTORY_SEPARATOR;
253
+        return $this->rootPath.'app'.DIRECTORY_SEPARATOR;
254 254
     }
255 255
 
256 256
     /**
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      */
309 309
     public function getConfigPath(): string
310 310
     {
311
-        return $this->rootPath . 'config' . DIRECTORY_SEPARATOR;
311
+        return $this->rootPath.'config'.DIRECTORY_SEPARATOR;
312 312
     }
313 313
 
314 314
     /**
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
         $this->beginMem  = memory_get_usage();
355 355
 
356 356
         // 加载环境变量
357
-        if (is_file($this->rootPath . '.env')) {
358
-            $this->env->load($this->rootPath . '.env');
357
+        if (is_file($this->rootPath.'.env')) {
358
+            $this->env->load($this->rootPath.'.env');
359 359
         }
360 360
 
361 361
         $this->configExt = $this->env->get('config_ext', '.php');
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
         // 加载框架默认语言包
369 369
         $langSet = $this->lang->defaultLangSet();
370 370
 
371
-        $this->lang->load($this->thinkPath . 'lang' . DIRECTORY_SEPARATOR . $langSet . '.php');
371
+        $this->lang->load($this->thinkPath.'lang'.DIRECTORY_SEPARATOR.$langSet.'.php');
372 372
 
373 373
         // 加载应用默认语言包
374 374
         $this->loadLangPack($langSet);
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
         }
408 408
 
409 409
         // 加载系统语言包
410
-        $files = glob($this->appPath . 'lang' . DIRECTORY_SEPARATOR . $langset . '.*');
410
+        $files = glob($this->appPath.'lang'.DIRECTORY_SEPARATOR.$langset.'.*');
411 411
         $this->lang->load($files);
412 412
 
413 413
         // 加载扩展(自定义)语言包
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
      */
426 426
     public function boot(): void
427 427
     {
428
-        array_walk($this->services, function ($service) {
428
+        array_walk($this->services, function($service) {
429 429
             $this->bootService($service);
430 430
         });
431 431
     }
@@ -439,30 +439,30 @@  discard block
 block discarded – undo
439 439
     {
440 440
         $appPath = $this->getAppPath();
441 441
 
442
-        if (is_file($appPath . 'common.php')) {
443
-            include $appPath . 'common.php';
442
+        if (is_file($appPath.'common.php')) {
443
+            include $appPath.'common.php';
444 444
         }
445 445
 
446
-        include $this->thinkPath . 'helper.php';
446
+        include $this->thinkPath.'helper.php';
447 447
 
448 448
         $configPath = $this->getConfigPath();
449 449
 
450 450
         $files = [];
451 451
 
452 452
         if (is_dir($configPath)) {
453
-            $files = glob($configPath . '*' . $this->configExt);
453
+            $files = glob($configPath.'*'.$this->configExt);
454 454
         }
455 455
 
456 456
         foreach ($files as $file) {
457 457
             $this->config->load($file, pathinfo($file, PATHINFO_FILENAME));
458 458
         }
459 459
 
460
-        if (is_file($appPath . 'event.php')) {
461
-            $this->loadEvent(include $appPath . 'event.php');
460
+        if (is_file($appPath.'event.php')) {
461
+            $this->loadEvent(include $appPath.'event.php');
462 462
         }
463 463
 
464
-        if (is_file($appPath . 'service.php')) {
465
-            $services = include $appPath . 'service.php';
464
+        if (is_file($appPath.'service.php')) {
465
+            $services = include $appPath.'service.php';
466 466
             foreach ($services as $service) {
467 467
                 $this->register($service);
468 468
             }
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
         $name  = str_replace(['/', '.'], '\\', $name);
528 528
         $array = explode('\\', $name);
529 529
         $class = self::parseName(array_pop($array), 1);
530
-        $path  = $array ? implode('\\', $array) . '\\' : '';
530
+        $path  = $array ? implode('\\', $array).'\\' : '';
531 531
 
532
-        return $this->namespace . '\\' . $layer . '\\' . $path . $class;
532
+        return $this->namespace.'\\'.$layer.'\\'.$path.$class;
533 533
     }
534 534
 
535 535
     /**
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
     {
551 551
         $path = dirname(dirname(dirname(dirname($this->thinkPath))));
552 552
 
553
-        return $path . DIRECTORY_SEPARATOR;
553
+        return $path.DIRECTORY_SEPARATOR;
554 554
     }
555 555
 
556 556
     /**
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
     public static function parseName(string $name = null, int $type = 0, bool $ucfirst = true): string
566 566
     {
567 567
         if ($type) {
568
-            $name = preg_replace_callback('/_([a-zA-Z])/', function ($match) {
568
+            $name = preg_replace_callback('/_([a-zA-Z])/', function($match) {
569 569
                 return strtoupper($match[1]);
570 570
             }, $name);
571 571
             return $ucfirst ? ucfirst($name) : lcfirst($name);
@@ -596,13 +596,13 @@  discard block
 block discarded – undo
596 596
      */
597 597
     public static function factory(string $name, string $namespace = '', ...$args)
598 598
     {
599
-        $class = false !== strpos($name, '\\') ? $name : $namespace . ucwords($name);
599
+        $class = false !== strpos($name, '\\') ? $name : $namespace.ucwords($name);
600 600
 
601 601
         if (class_exists($class)) {
602 602
             return Container::getInstance()->invokeClass($class, $args);
603 603
         }
604 604
 
605
-        throw new ClassNotFoundException('class not exists:' . $class, $class);
605
+        throw new ClassNotFoundException('class not exists:'.$class, $class);
606 606
     }
607 607
 
608 608
     /**
Please login to merge, or discard this patch.
src/think/route/Dispatch.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\route;
14 14
 
Please login to merge, or discard this patch.
src/think/route/Domain.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\route;
14 14
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
             $this->parseUrlParams($array[2], $param);
157 157
         }
158 158
 
159
-        return new CallbackDispatch($request, $this, [$namespace . '\\' . App::parseName($class, 1), $method], $param);
159
+        return new CallbackDispatch($request, $this, [$namespace.'\\'.App::parseName($class, 1), $method], $param);
160 160
     }
161 161
 
162 162
     /**
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             $this->parseUrlParams($array[1], $param);
178 178
         }
179 179
 
180
-        return new ControllerDispatch($request, $this, $controller . '/' . $action, $param);
180
+        return new ControllerDispatch($request, $this, $controller.'/'.$action, $param);
181 181
     }
182 182
 
183 183
 }
Please login to merge, or discard this patch.
src/think/route/RuleGroup.php 1 patch
Spacing   +13 added lines, -13 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
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         }
110 110
 
111 111
         if ($this->parent && $this->parent->getFullName()) {
112
-            $this->fullName = $this->parent->getFullName() . ($this->name ? '/' . $this->name : '');
112
+            $this->fullName = $this->parent->getFullName().($this->name ? '/'.$this->name : '');
113 113
         } else {
114 114
             $this->fullName = $this->name;
115 115
         }
@@ -304,13 +304,13 @@  discard block
 block discarded – undo
304 304
     protected function checkMergeRuleRegex(Request $request, array &$rules, string $url, bool $completeMatch)
305 305
     {
306 306
         $depr  = $this->router->config('pathinfo_depr');
307
-        $url   = $depr . str_replace('|', $depr, $url);
307
+        $url   = $depr.str_replace('|', $depr, $url);
308 308
         $regex = [];
309 309
         $items = [];
310 310
 
311 311
         foreach ($rules as $key => $item) {
312 312
             if ($item instanceof RuleItem) {
313
-                $rule = $depr . str_replace('/', $depr, $item->getRule());
313
+                $rule = $depr.str_replace('/', $depr, $item->getRule());
314 314
                 if ($depr == $rule && $depr != $url) {
315 315
                     unset($rules[$key]);
316 316
                     continue;
@@ -327,21 +327,21 @@  discard block
 block discarded – undo
327 327
                     continue;
328 328
                 }
329 329
 
330
-                $slash = preg_quote('/-' . $depr, '/');
330
+                $slash = preg_quote('/-'.$depr, '/');
331 331
 
332
-                if ($matchRule = preg_split('/[' . $slash . ']<\w+\??>/', $rule, 2)) {
332
+                if ($matchRule = preg_split('/['.$slash.']<\w+\??>/', $rule, 2)) {
333 333
                     if ($matchRule[0] && 0 !== strncasecmp($rule, $url, strlen($matchRule[0]))) {
334 334
                         unset($rules[$key]);
335 335
                         continue;
336 336
                     }
337 337
                 }
338 338
 
339
-                if (preg_match_all('/[' . $slash . ']?<?\w+\??>?/', $rule, $matches)) {
339
+                if (preg_match_all('/['.$slash.']?<?\w+\??>?/', $rule, $matches)) {
340 340
                     unset($rules[$key]);
341 341
                     $pattern = array_merge($this->getPattern(), $item->getPattern());
342 342
                     $option  = array_merge($this->getOption(), $item->getOption());
343 343
 
344
-                    $regex[$key] = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $complete, '_THINK_' . $key);
344
+                    $regex[$key] = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $complete, '_THINK_'.$key);
345 345
                     $items[$key] = $item;
346 346
                 }
347 347
             }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
         }
353 353
 
354 354
         try {
355
-            $result = preg_match('/^(?:' . implode('|', $regex) . ')/u', $url, $match);
355
+            $result = preg_match('/^(?:'.implode('|', $regex).')/u', $url, $match);
356 356
         } catch (\Exception $e) {
357 357
             throw new Exception('route pattern error');
358 358
         }
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 
370 370
             if (!isset($pos)) {
371 371
                 foreach ($regex as $key => $item) {
372
-                    if (0 === strpos(str_replace(['\/', '\-', '\\' . $depr], ['/', '-', $depr], $item), $match[0])) {
372
+                    if (0 === strpos(str_replace(['\/', '\-', '\\'.$depr], ['/', '-', $depr], $item), $match[0])) {
373 373
                         $pos = $key;
374 374
                         break;
375 375
                     }
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
      * @access public
399 399
      * @return RuleItem|null
400 400
      */
401
-    public function getMissRule():  ? RuleItem
401
+    public function getMissRule(): ? RuleItem
402 402
     {
403 403
         return $this->miss;
404 404
     }
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
     public function prefix(string $prefix)
474 474
     {
475 475
         if ($this->parent && $this->parent->getOption('prefix')) {
476
-            $prefix = $this->parent->getOption('prefix') . $prefix;
476
+            $prefix = $this->parent->getOption('prefix').$prefix;
477 477
         }
478 478
 
479 479
         return $this->setOption('prefix', $prefix);
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
      * @access public
529 529
      * @return string
530 530
      */
531
-    public function getFullName():  ? string
531
+    public function getFullName(): ? string
532 532
     {
533 533
         return $this->fullName;
534 534
     }
Please login to merge, or discard this patch.
src/think/route/Resource.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: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\route;
14 14
 
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
             $item  = [];
91 91
 
92 92
             foreach ($array as $val) {
93
-                $item[] = $val . '/<' . ($option['var'][$val] ?? $val . '_id') . '>';
93
+                $item[] = $val.'/<'.($option['var'][$val] ?? $val.'_id').'>';
94 94
             }
95 95
 
96
-            $rule = implode('/', $item) . '/' . $last;
96
+            $rule = implode('/', $item).'/'.$last;
97 97
         }
98 98
 
99 99
         $prefix = substr($rule, strlen($this->name) + 1);
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
             }
107 107
 
108 108
             if (isset($last) && strpos($val[1], '<id>') && isset($option['var'][$last])) {
109
-                $val[1] = str_replace('<id>', '<' . $option['var'][$last] . '>', $val[1]);
109
+                $val[1] = str_replace('<id>', '<'.$option['var'][$last].'>', $val[1]);
110 110
             } elseif (strpos($val[1], '<id>') && isset($option['var'][$rule])) {
111
-                $val[1] = str_replace('<id>', '<' . $option['var'][$rule] . '>', $val[1]);
111
+                $val[1] = str_replace('<id>', '<'.$option['var'][$rule].'>', $val[1]);
112 112
             }
113 113
 
114
-            $this->addRule(trim($prefix . $val[1], '/'), $this->route . '/' . $val[2], $val[0]);
114
+            $this->addRule(trim($prefix.$val[1], '/'), $this->route.'/'.$val[2], $val[0]);
115 115
         }
116 116
 
117 117
         $this->router->setGroup($origin);
Please login to merge, or discard this patch.