Passed
Push — master ( 92182b...13d26f )
by 世昌
03:14
created
nebula/request/file/UploadedFile.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 /**
8 8
  * HTTP请求文件
9 9
  */
10
-class UploadedFile  extends File  {
10
+class UploadedFile  extends File {
11 11
 
12 12
     private $originalName;
13 13
     private $mimeType;
Please login to merge, or discard this patch.
nebula/request/file/File.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 /**
6 6
  * HTTP请求文件
7 7
  */
8
-class File  extends \SplFileInfo  {
8
+class File  extends \SplFileInfo {
9 9
     /**
10 10
      * 创建文件
11 11
      *
Please login to merge, or discard this patch.
nebula/request/attribute/FormDataAttribute.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @return array|null
50 50
      */
51
-    public function json():?array {
51
+    public function json(): ?array {
52 52
         if (isset($this->json)) {
53 53
             return $this->json;
54 54
         }
55
-        $data =json_decode($this->input(), true, 512, JSON_BIGINT_AS_STRING);
56
-        if (json_last_error()!==JSON_ERROR_NONE) {
55
+        $data = json_decode($this->input(), true, 512, JSON_BIGINT_AS_STRING);
56
+        if (json_last_error() !== JSON_ERROR_NONE) {
57 57
             $this->json = null;
58 58
         }
59 59
         return $this->json = $data;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      * @param mixed $default
67 67
      * @return mixed
68 68
      */
69
-    public function get(?string $name=null, $default =null)
69
+    public function get(?string $name = null, $default = null)
70 70
     {
71 71
         return $this->getParameter($name, $default);
72 72
     }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      * @param mixed $default
79 79
      * @return mixed 获取的值
80 80
      */
81
-    public static function post(?string $name=null, $default=null)
81
+    public static function post(?string $name = null, $default = null)
82 82
     {
83 83
         if (is_null($name)) {
84 84
             return $_POST;
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      * @param string|null $name
129 129
      * @return boolean
130 130
      */
131
-    public function hasGet(?string $name=null)
131
+    public function hasGet(?string $name = null)
132 132
     {
133 133
         $get = $this->getParameter();
134 134
         if (is_null($name)) {
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      *
158 158
      * @return boolean
159 159
      */
160
-    public function hasPost(?string $name=null)
160
+    public function hasPost(?string $name = null)
161 161
     {
162 162
         $post = $this->post();
163 163
         if ($name) {
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
      * @param mixed $default
181 181
      * @return mixed
182 182
      */
183
-    abstract public function getHeader(string $name, $default =null);
183
+    abstract public function getHeader(string $name, $default = null);
184 184
     /**
185 185
      * 获取请求参数
186 186
      *
Please login to merge, or discard this patch.
nebula/request/attribute/AttributeAbstract.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      *
36 36
      * @return array|null
37 37
      */
38
-    public function json():?array;
38
+    public function json(): ?array;
39 39
    
40 40
     /**
41 41
      * 获取GET参数
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * @param mixed $default
45 45
      * @return mixed
46 46
      */
47
-    public function get(?string $name=null, $default =null);
47
+    public function get(?string $name = null, $default = null);
48 48
 
49 49
     /**
50 50
      * 获取POST请求的值
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @param mixed $default
54 54
      * @return mixed 获取的值
55 55
      */
56
-    public static function post(?string $name=null, $default=null);
56
+    public static function post(?string $name = null, $default = null);
57 57
 
58 58
     /**
59 59
      * 获取HTTP输入
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      * @param string|null $name
77 77
      * @return boolean
78 78
      */
79
-    public function hasGet(?string $name=null);
79
+    public function hasGet(?string $name = null);
80 80
 
81 81
     /**
82 82
      * 判断是否有JSON数据请求
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @return boolean
92 92
      */
93
-    public function hasPost(?string $name=null);
93
+    public function hasPost(?string $name = null);
94 94
     
95 95
     /**
96 96
      * 获取参数
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      * @param mixed $default
107 107
      * @return mixed
108 108
      */
109
-    public function getHeader(string $name, $default =null);
109
+    public function getHeader(string $name, $default = null);
110 110
 
111 111
     // URI
112 112
     /**
Please login to merge, or discard this patch.
nebula/request/Request.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * @param mixed $default
60 60
      * @return mixed
61 61
      */
62
-    public function getHeader(string $name, $default =null) {
62
+    public function getHeader(string $name, $default = null) {
63 63
         if (array_key_exists(strtolower($name), $this->headers)) {
64 64
             return $this->headers[$name];
65 65
         }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function ip()
85 85
     {
86
-        static $ipFrom = ['HTTP_CLIENT_IP','HTTP_X_FORWARDED_FOR','HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP','HTTP_FORWARDED_FOR','HTTP_FORWARDED','REMOTE_ADDR'];
86
+        static $ipFrom = ['HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR'];
87 87
         foreach ($ipFrom as $key) {
88 88
             if (array_key_exists($key, $_SERVER)) {
89 89
                 foreach (explode(',', $_SERVER[$key]) as $ip) {
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
     public static function buildFromServer(): Request {
105 105
         $method = strtoupper($_SERVER['REQUEST_METHOD'] ?? 'GET');
106 106
         $uri = $_SERVER['REQUEST_URI']??'/';
107
-        $headers  = HeaderItem::buildFromServer($_SERVER);
108
-        $request =  new Request($method, $uri, $headers);
107
+        $headers = HeaderItem::buildFromServer($_SERVER);
108
+        $request = new Request($method, $uri, $headers);
109 109
         $request->setDocumentRoot($_SERVER['DOCUMENT_ROOT']);
110 110
         return $request;
111 111
     }
Please login to merge, or discard this patch.