@@ -2,16 +2,10 @@ |
||
2 | 2 | namespace Kambo\HttpMessage\Factories\Enviroment; |
3 | 3 | |
4 | 4 | // \Spl |
5 | -use InvalidArgumentException; |
|
6 | 5 | |
7 | 6 | // \Psr |
8 | -use Psr\Http\Message\ServerRequestInterface; |
|
9 | -use Psr\Http\Message\UriInterface; |
|
10 | 7 | |
11 | 8 | // \HttpMessage |
12 | -use Kambo\HttpMessage\Uri; |
|
13 | -use Kambo\HttpMessage\UploadedFile; |
|
14 | -use Kambo\HttpMessage\Headers; |
|
15 | 9 | use Kambo\HttpMessage\ServerRequest; |
16 | 10 | |
17 | 11 | // \HttpMessage\Enviroment |
@@ -5,13 +5,10 @@ |
||
5 | 5 | use InvalidArgumentException; |
6 | 6 | |
7 | 7 | // \Psr |
8 | -use Psr\Http\Message\RequestInterface; |
|
9 | 8 | use Psr\Http\Message\UriInterface; |
10 | 9 | |
11 | 10 | // \HttpMessage |
12 | -use Kambo\HttpMessage\Uri; |
|
13 | 11 | use Kambo\HttpMessage\Message; |
14 | -use Kambo\HttpMessage\Headers; |
|
15 | 12 | |
16 | 13 | /** |
17 | 14 | * Shared methods for outgoing, client-side request and server request. |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $target = '/'; |
52 | 52 | if ($this->uri->getPath() !== null) { |
53 | 53 | $target = $this->uri->getPath(); |
54 | - $target .= (!empty($this->uri->getQuery())) ? '?'.$this->uri->getQuery() : ''; |
|
54 | + $target .= (!empty($this->uri->getQuery())) ? '?' . $this->uri->getQuery() : ''; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $this->requestTarget = $target; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function withUri(UriInterface $uri, $preserveHost = false) |
178 | 178 | { |
179 | - $clone = clone $this; |
|
179 | + $clone = clone $this; |
|
180 | 180 | $clone->uri = $uri; |
181 | 181 | |
182 | 182 | if (!$preserveHost) { |
@@ -2,7 +2,6 @@ |
||
2 | 2 | namespace Kambo\HttpMessage; |
3 | 3 | |
4 | 4 | // \Spl |
5 | -use InvalidArgumentException; |
|
6 | 5 | use RuntimeException; |
7 | 6 | |
8 | 7 | // \Psr |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @var integer |
42 | 42 | */ |
43 | - const HTTP_PORT = 80; |
|
43 | + const HTTP_PORT = 80; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Https port |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $port = $this->getPort(); |
199 | 199 | $userInfo = $this->getUserInfo(); |
200 | 200 | |
201 | - return ($userInfo ? $userInfo. '@' : '').$this->getHost().($port ? ':' . $port : ''); |
|
201 | + return ($userInfo ? $userInfo . '@' : '') . $this->getHost() . ($port ? ':' . $port : ''); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | if (!empty($this->user)) { |
221 | 221 | $userInfo = $this->user; |
222 | 222 | if (!empty($this->password)) { |
223 | - $userInfo .= ':'.$this->password; |
|
223 | + $userInfo .= ':' . $this->password; |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | $this->validatePath($path); |
471 | 471 | |
472 | 472 | $clone = clone $this; |
473 | - $clone->path = $this->urlEncode((string)$path); |
|
473 | + $clone->path = $this->urlEncode((string) $path); |
|
474 | 474 | |
475 | 475 | return $clone; |
476 | 476 | } |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | $this->validateQuery($query); |
498 | 498 | |
499 | 499 | $clone = clone $this; |
500 | - $clone->query = $this->urlEncode((string)$query); |
|
500 | + $clone->query = $this->urlEncode((string) $query); |
|
501 | 501 | |
502 | 502 | return $clone; |
503 | 503 | } |
@@ -566,8 +566,8 @@ discard block |
||
566 | 566 | |
567 | 567 | $path = '/' . ltrim($path, '/'); |
568 | 568 | |
569 | - return ($scheme ? $scheme.':' : '').($authority ? '//'.$authority : '') |
|
570 | - .$path.($query ? '?' . $query : '').($fragment ? '#' . $fragment : ''); |
|
569 | + return ($scheme ? $scheme . ':' : '') . ($authority ? '//' . $authority : '') |
|
570 | + .$path . ($query ? '?' . $query : '') . ($fragment ? '#' . $fragment : ''); |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | // ------------ PRIVATE METHODS |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | throw new InvalidArgumentException('Uri scheme must be a string'); |
600 | 600 | } |
601 | 601 | |
602 | - $scheme = str_replace('://', '', strtolower((string)$scheme)); |
|
602 | + $scheme = str_replace('://', '', strtolower((string) $scheme)); |
|
603 | 603 | if (!isset($this->validSchema[$scheme])) { |
604 | 604 | throw new InvalidArgumentException('Uri scheme must be one of: "", "https", "http"'); |
605 | 605 | } |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | { |
703 | 703 | return preg_replace_callback( |
704 | 704 | '/(?:[^a-zA-Z0-9_\-\.~:@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/', |
705 | - function ($match) { |
|
705 | + function($match) { |
|
706 | 706 | return rawurlencode($match[0]); |
707 | 707 | }, |
708 | 708 | $path |
@@ -123,6 +123,9 @@ |
||
123 | 123 | return $this->data; |
124 | 124 | } |
125 | 125 | |
126 | + /** |
|
127 | + * @param string $name |
|
128 | + */ |
|
126 | 129 | public function remove($name) |
127 | 130 | { |
128 | 131 | $name = $this->normalizeName($name); |
@@ -12,7 +12,6 @@ |
||
12 | 12 | // \HttpMessage |
13 | 13 | use Kambo\HttpMessage\Uri; |
14 | 14 | use Kambo\HttpMessage\Message; |
15 | -use Kambo\HttpMessage\UploadedFile; |
|
16 | 15 | use Kambo\HttpMessage\Headers; |
17 | 16 | use Kambo\HttpMessage\Parser\Parser; |
18 | 17 | use Kambo\HttpMessage\RequestTrait; |
@@ -130,8 +130,8 @@ |
||
130 | 130 | * @param UriInterface $uri The request URI object |
131 | 131 | * @param array|null $cookies The request cookies collection |
132 | 132 | * @param string $requestMethod The request method |
133 | - * @param array $uploadedFiles The request uploadedFiles collection |
|
134 | - * @param HeadersInterface $headers The request headers collection |
|
133 | + * @param array $uploadFiles The request uploadedFiles collection |
|
134 | + * @param Headers $headers The request headers collection |
|
135 | 135 | * @param StreamInterface|null $body The request body object |
136 | 136 | * @param array $serverVariables The server environment variables |
137 | 137 | * @param string $protocol The request version of the protocol |