Passed
Push — master ( 2ddbad...aa2fc1 )
by 世昌
02:16
created
nebula/request/attribute/URIAttribute.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -150,26 +150,26 @@  discard block
 block discarded – undo
150 150
     {
151 151
         $url = $this->uri;
152 152
 
153
-        $queryString='';
153
+        $queryString = '';
154 154
         // for /?/xx
155 155
         if (\strpos($url, '/?/') === 0) {
156 156
             $url = substr($url, 2);
157 157
         }
158 158
         $indexFile = $this->getIndexFile();
159
-        if (\strpos($url, $indexFile) ===0) {
159
+        if (\strpos($url, $indexFile) === 0) {
160 160
             // for /index.php/
161
-            $url = \substr($url, strlen($indexFile));// for /index.php?/
161
+            $url = \substr($url, strlen($indexFile)); // for /index.php?/
162 162
             if (\strpos($url, '?/') === 0) {
163 163
                 $url = ltrim($url, '?');
164 164
             }
165 165
             // for /index.php
166
-            elseif (\strpos($url, '/')!== 0) {
166
+            elseif (\strpos($url, '/') !== 0) {
167 167
                 $url = '/'.$url;
168 168
             }
169 169
         }
170 170
         $queryStart = \strpos($url, '?');
171 171
         if ($queryStart !== false) {
172
-            $queryString = \substr($url, $queryStart+1);
172
+            $queryString = \substr($url, $queryStart + 1);
173 173
             $url = \substr($url, 0, $queryStart);
174 174
         }
175 175
         $this->url = $url;
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             parse_str($queryString, $this->queryParameter);
178 178
         }
179 179
         if ($applyServer) {
180
-            $_SERVER['PATH_INFO'] =  $this->url;
180
+            $_SERVER['PATH_INFO'] = $this->url;
181 181
             $_SERVER['SCRIPT_NAME'] = $this->getIndexFile();
182 182
             $_SERVER['PHP_SELF'] = $this->getIndexFile();
183 183
             $_GET = $this->queryParameter;
Please login to merge, or discard this patch.
nebula/request/Request.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * HTTP请求解析器
11 11
  *
12 12
  */
13
-class Request   {
13
+class Request {
14 14
 
15 15
     use URIAttribute;
16 16
     
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @param mixed $default
59 59
      * @return mixed
60 60
      */
61
-    public function getHeader(string $name, $default =null) {
61
+    public function getHeader(string $name, $default = null) {
62 62
         if (array_key_exists(strtolower($name), $this->headers)) {
63 63
             return $this->headers[$name];
64 64
         }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function ip()
84 84
     {
85
-        static $ipFrom = ['HTTP_CLIENT_IP','HTTP_X_FORWARDED_FOR','HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP','HTTP_FORWARDED_FOR','HTTP_FORWARDED','REMOTE_ADDR'];
85
+        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 86
         foreach ($ipFrom as $key) {
87 87
             if (array_key_exists($key, $_SERVER)) {
88 88
                 foreach (explode(',', $_SERVER[$key]) as $ip) {
Please login to merge, or discard this patch.