@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * HTTP请求解析器 |
12 | 12 | * |
13 | 13 | */ |
14 | -class Request { |
|
14 | +class Request { |
|
15 | 15 | |
16 | 16 | use URIAttribute; |
17 | 17 | use FormDataAttribute; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param mixed $default |
61 | 61 | * @return mixed |
62 | 62 | */ |
63 | - public function getHeader(string $name, $default =null) { |
|
63 | + public function getHeader(string $name, $default = null) { |
|
64 | 64 | if (array_key_exists(strtolower($name), $this->headers)) { |
65 | 65 | return $this->headers[$name]; |
66 | 66 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function ip() |
86 | 86 | { |
87 | - 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 | + static $ipFrom = ['HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR']; |
|
88 | 88 | foreach ($ipFrom as $key) { |
89 | 89 | if (array_key_exists($key, $_SERVER)) { |
90 | 90 | foreach (explode(',', $_SERVER[$key]) as $ip) { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @var array |
29 | 29 | */ |
30 | - protected static $headers =[ |
|
30 | + protected static $headers = [ |
|
31 | 31 | 'content-type' => ContentTypeItem::class, |
32 | 32 | ]; |
33 | 33 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | if ($value instanceof HeaderItem) { |
70 | 70 | $header = $value; |
71 | 71 | } elseif (array_key_exists($name, static::$headers)) { |
72 | - $class =static::$headers[$name]; |
|
72 | + $class = static::$headers[$name]; |
|
73 | 73 | $header = new $class($name, $value); |
74 | 74 | } else { |
75 | 75 | $header = new HeaderItem($name, $value); |