Passed
Pull Request — 5.1 (#2217)
by
unknown
13:33
created
library/think/Request.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
             return call_user_func_array($this->hook[$method], $args);
332 332
         }
333 333
 
334
-        throw new Exception('method not exists:' . static::class . '->' . $method);
334
+        throw new Exception('method not exists:'.static::class.'->'.$method);
335 335
     }
336 336
 
337 337
     /**
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 
386 386
         if (isset($info['port'])) {
387 387
             $server['SERVER_PORT'] = $info['port'];
388
-            $server['HTTP_HOST']   = $server['HTTP_HOST'] . ':' . $info['port'];
388
+            $server['HTTP_HOST']   = $server['HTTP_HOST'].':'.$info['port'];
389 389
         }
390 390
 
391 391
         if (isset($info['user'])) {
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
             $options['get'] = isset($options['get']) ? array_merge($get, $options['get']) : $get;
424 424
         }
425 425
 
426
-        $server['REQUEST_URI']  = $info['path'] . ('' !== $queryString ? '?' . $queryString : '');
426
+        $server['REQUEST_URI']  = $info['path'].('' !== $queryString ? '?'.$queryString : '');
427 427
         $server['QUERY_STRING'] = $queryString;
428 428
         $options['cookie']      = $cookie;
429 429
         $options['param']       = $params;
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
         $options['baseUrl']     = $info['path'];
434 434
         $options['pathinfo']    = '/' == $info['path'] ? '/' : ltrim($info['path'], '/');
435 435
         $options['method']      = $server['REQUEST_METHOD'];
436
-        $options['domain']      = isset($info['scheme']) ? $info['scheme'] . '://' . $server['HTTP_HOST'] : '';
436
+        $options['domain']      = isset($info['scheme']) ? $info['scheme'].'://'.$server['HTTP_HOST'] : '';
437 437
         $options['content']     = $content;
438 438
 
439 439
         $request = new static();
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
      */
455 455
     public function domain($port = false)
456 456
     {
457
-        return $this->scheme() . '://' . $this->host($port);
457
+        return $this->scheme().'://'.$this->host($port);
458 458
     }
459 459
 
460 460
     /**
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
         if (!$root) {
470 470
             $item  = explode('.', $this->host(true));
471 471
             $count = count($item);
472
-            $root  = $count > 1 ? $item[$count - 2] . '.' . $item[$count - 1] : $item[0];
472
+            $root  = $count > 1 ? $item[$count - 2].'.'.$item[$count - 1] : $item[0];
473 473
         }
474 474
 
475 475
         return $root;
@@ -549,13 +549,13 @@  discard block
 block discarded – undo
549 549
             } elseif ($this->server('REQUEST_URI')) {
550 550
                 $this->url = $this->server('REQUEST_URI');
551 551
             } elseif ($this->server('ORIG_PATH_INFO')) {
552
-                $this->url = $this->server('ORIG_PATH_INFO') . (!empty($this->server('QUERY_STRING')) ? '?' . $this->server('QUERY_STRING') : '');
552
+                $this->url = $this->server('ORIG_PATH_INFO').(!empty($this->server('QUERY_STRING')) ? '?'.$this->server('QUERY_STRING') : '');
553 553
             } else {
554 554
                 $this->url = '';
555 555
             }
556 556
         }
557 557
 
558
-        return $complete ? $this->domain() . $this->url : $this->url;
558
+        return $complete ? $this->domain().$this->url : $this->url;
559 559
     }
560 560
 
561 561
     /**
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
             $this->baseUrl = strpos($str, '?') ? strstr($str, '?', true) : $str;
584 584
         }
585 585
 
586
-        return $domain ? $this->domain() . $this->baseUrl : $this->baseUrl;
586
+        return $domain ? $this->domain().$this->baseUrl : $this->baseUrl;
587 587
     }
588 588
 
589 589
     /**
@@ -604,8 +604,8 @@  discard block
 block discarded – undo
604 604
                     $url = $this->server('PHP_SELF');
605 605
                 } elseif (basename($this->server('ORIG_SCRIPT_NAME')) === $script_name) {
606 606
                     $url = $this->server('ORIG_SCRIPT_NAME');
607
-                } elseif (($pos = strpos($this->server('PHP_SELF'), '/' . $script_name)) !== false) {
608
-                    $url = substr($this->server('SCRIPT_NAME'), 0, $pos) . '/' . $script_name;
607
+                } elseif (($pos = strpos($this->server('PHP_SELF'), '/'.$script_name)) !== false) {
608
+                    $url = substr($this->server('SCRIPT_NAME'), 0, $pos).'/'.$script_name;
609 609
                 } elseif ($this->server('DOCUMENT_ROOT') && strpos($this->server('SCRIPT_FILENAME'), $this->server('DOCUMENT_ROOT')) === 0) {
610 610
                     $url = str_replace('\\', '/', str_replace($this->server('DOCUMENT_ROOT'), '', $this->server('SCRIPT_FILENAME')));
611 611
                 }
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
             $this->baseFile = $url;
614 614
         }
615 615
 
616
-        return $domain ? $this->domain() . $this->baseFile : $this->baseFile;
616
+        return $domain ? $this->domain().$this->baseFile : $this->baseFile;
617 617
     }
618 618
 
619 619
     /**
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
             $this->root = rtrim($file, '/');
645 645
         }
646 646
 
647
-        return $domain ? $this->domain() . $this->root : $this->root;
647
+        return $domain ? $this->domain().$this->root : $this->root;
648 648
     }
649 649
 
650 650
     /**
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
         $root = strpos($base, '.') ? ltrim(dirname($base), DIRECTORY_SEPARATOR) : $base;
659 659
 
660 660
         if ('' != $root) {
661
-            $root = '/' . ltrim($root, '/');
661
+            $root = '/'.ltrim($root, '/');
662 662
         }
663 663
 
664 664
         return $root;
@@ -729,10 +729,10 @@  discard block
 block discarded – undo
729 729
                 $this->path = $pathinfo;
730 730
             } elseif ($suffix) {
731 731
                 // 去除正常的URL后缀
732
-                $this->path = preg_replace('/\.(' . ltrim($suffix, '.') . ')$/i', '', $pathinfo);
732
+                $this->path = preg_replace('/\.('.ltrim($suffix, '.').')$/i', '', $pathinfo);
733 733
             } else {
734 734
                 // 允许任何后缀访问
735
-                $this->path = preg_replace('/\.' . $this->ext() . '$/i', '', $pathinfo);
735
+                $this->path = preg_replace('/\.'.$this->ext().'$/i', '', $pathinfo);
736 736
             }
737 737
         }
738 738
 
@@ -1211,8 +1211,8 @@  discard block
 block discarded – undo
1211 1211
             if ($file instanceof File) {
1212 1212
                 $array[$key] = $file;
1213 1213
             } elseif (is_array($file['name'])) {
1214
-                $keys  = array_keys($file);
1215
-                $subFileNames=array_keys($file['name']);
1214
+                $keys = array_keys($file);
1215
+                $subFileNames = array_keys($file['name']);
1216 1216
 
1217 1217
                 foreach ($subFileNames as $index => $subFileName) {
1218 1218
                     if ($file['error'][$subFileName] > 0) {
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
                 if (is_scalar($data)) {
1513 1513
                     $data = (string) $data;
1514 1514
                 } else {
1515
-                    throw new \InvalidArgumentException('variable type error:' . gettype($data));
1515
+                    throw new \InvalidArgumentException('variable type error:'.gettype($data));
1516 1516
                 }
1517 1517
                 break;
1518 1518
         }
@@ -2024,7 +2024,7 @@  discard block
 block discarded – undo
2024 2024
         $token = call_user_func($type, $this->server('REQUEST_TIME_FLOAT'));
2025 2025
 
2026 2026
         if ($this->isAjax()) {
2027
-            header($name . ': ' . $token);
2027
+            header($name.': '.$token);
2028 2028
         }
2029 2029
 
2030 2030
         facade\Session::set($name, $token);
@@ -2079,12 +2079,12 @@  discard block
 block discarded – undo
2079 2079
         if (false !== strpos($key, ':')) {
2080 2080
             $param = $this->param();
2081 2081
             foreach ($param as $item => $val) {
2082
-                if (is_string($val) && false !== strpos($key, ':' . $item)) {
2083
-                    $key = str_replace(':' . $item, $val, $key);
2082
+                if (is_string($val) && false !== strpos($key, ':'.$item)) {
2083
+                    $key = str_replace(':'.$item, $val, $key);
2084 2084
                 }
2085 2085
             }
2086 2086
         } elseif (strpos($key, ']')) {
2087
-            if ('[' . $this->ext() . ']' == $key) {
2087
+            if ('['.$this->ext().']' == $key) {
2088 2088
                 // 缓存某个后缀的请求
2089 2089
                 $key = md5($this->url());
2090 2090
             } else {
Please login to merge, or discard this patch.