Passed
Pull Request — 5.1 (#2217)
by
unknown
06:42
created
library/think/Request.php 2 patches
Spacing   +29 added lines, -29 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
 
@@ -1209,19 +1209,19 @@  discard block
 block discarded – undo
1209 1209
             if ($file instanceof File) {
1210 1210
                 $array[$key] = $file;
1211 1211
             } elseif (is_array($file['name'])) {
1212
-                $keys  = array_keys($file);
1213
-                $array[$key]=[];
1214
-                list($_name,$subName)=explode('.',$name);
1215
-                $subFileNames=array_keys($file['name']);
1212
+                $keys = array_keys($file);
1213
+                $array[$key] = [];
1214
+                list($_name, $subName) = explode('.', $name);
1215
+                $subFileNames = array_keys($file['name']);
1216 1216
                 foreach ($subFileNames as $index => $subFileName) {
1217
-                    $errorNo=$file['error'][$subFileName];
1217
+                    $errorNo = $file['error'][$subFileName];
1218 1218
                     if ($errorNo > 0) {
1219
-                        if($_name==$name){
1219
+                        if ($_name == $name) {
1220 1220
                             //没有.符号时,忽略没上传的文件
1221
-                            if($errorNo==4){
1221
+                            if ($errorNo == 4) {
1222 1222
                                 continue;
1223 1223
                             }
1224
-                        }else {
1224
+                        } else {
1225 1225
                             //有.符号,但是二级名称不匹配时
1226 1226
                             if ($subName != $subFileName) {
1227 1227
                                 continue;
@@ -1519,7 +1519,7 @@  discard block
 block discarded – undo
1519 1519
                 if (is_scalar($data)) {
1520 1520
                     $data = (string) $data;
1521 1521
                 } else {
1522
-                    throw new \InvalidArgumentException('variable type error:' . gettype($data));
1522
+                    throw new \InvalidArgumentException('variable type error:'.gettype($data));
1523 1523
                 }
1524 1524
                 break;
1525 1525
         }
@@ -2031,7 +2031,7 @@  discard block
 block discarded – undo
2031 2031
         $token = call_user_func($type, $this->server('REQUEST_TIME_FLOAT'));
2032 2032
 
2033 2033
         if ($this->isAjax()) {
2034
-            header($name . ': ' . $token);
2034
+            header($name.': '.$token);
2035 2035
         }
2036 2036
 
2037 2037
         facade\Session::set($name, $token);
@@ -2086,12 +2086,12 @@  discard block
 block discarded – undo
2086 2086
         if (false !== strpos($key, ':')) {
2087 2087
             $param = $this->param();
2088 2088
             foreach ($param as $item => $val) {
2089
-                if (is_string($val) && false !== strpos($key, ':' . $item)) {
2090
-                    $key = str_replace(':' . $item, $val, $key);
2089
+                if (is_string($val) && false !== strpos($key, ':'.$item)) {
2090
+                    $key = str_replace(':'.$item, $val, $key);
2091 2091
                 }
2092 2092
             }
2093 2093
         } elseif (strpos($key, ']')) {
2094
-            if ('[' . $this->ext() . ']' == $key) {
2094
+            if ('['.$this->ext().']' == $key) {
2095 2095
                 // 缓存某个后缀的请求
2096 2096
                 $key = md5($this->url());
2097 2097
             } else {
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1221,7 +1221,7 @@
 block discarded – undo
1221 1221
                             if($errorNo==4){
1222 1222
                                 continue;
1223 1223
                             }
1224
-                        }else {
1224
+                        } else {
1225 1225
                             //有.符号,但是二级名称不匹配时
1226 1226
                             if ($subName != $subFileName) {
1227 1227
                                 continue;
Please login to merge, or discard this patch.