Passed
Pull Request — master (#31)
by Anatoly
39:30
created
src/ServerRequestFactory.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -26,59 +26,59 @@
 block discarded – undo
26 26
 class ServerRequestFactory implements ServerRequestFactoryInterface
27 27
 {
28 28
 
29
-    /**
30
-     * Creates a new request from superglobals variables
31
-     *
32
-     * @param array|null $serverParams
33
-     * @param array|null $queryParams
34
-     * @param array|null $cookieParams
35
-     * @param array|null $uploadedFiles
36
-     * @param array|null $parsedBody
37
-     *
38
-     * @return ServerRequestInterface
39
-     *
40
-     * @link http://php.net/manual/en/language.variables.superglobals.php
41
-     * @link https://www.php-fig.org/psr/psr-15/meta/
42
-     */
43
-    public static function fromGlobals(
44
-        ?array $serverParams = null,
45
-        ?array $queryParams = null,
46
-        ?array $cookieParams = null,
47
-        ?array $uploadedFiles = null,
48
-        ?array $parsedBody = null
49
-    ): ServerRequestInterface {
50
-        $serverParams  = $serverParams  ?? $_SERVER;
51
-        $queryParams   = $queryParams   ?? $_GET;
52
-        $cookieParams  = $cookieParams  ?? $_COOKIE;
53
-        $uploadedFiles = $uploadedFiles ?? $_FILES;
54
-        $parsedBody    = $parsedBody    ?? $_POST;
29
+	/**
30
+	 * Creates a new request from superglobals variables
31
+	 *
32
+	 * @param array|null $serverParams
33
+	 * @param array|null $queryParams
34
+	 * @param array|null $cookieParams
35
+	 * @param array|null $uploadedFiles
36
+	 * @param array|null $parsedBody
37
+	 *
38
+	 * @return ServerRequestInterface
39
+	 *
40
+	 * @link http://php.net/manual/en/language.variables.superglobals.php
41
+	 * @link https://www.php-fig.org/psr/psr-15/meta/
42
+	 */
43
+	public static function fromGlobals(
44
+		?array $serverParams = null,
45
+		?array $queryParams = null,
46
+		?array $cookieParams = null,
47
+		?array $uploadedFiles = null,
48
+		?array $parsedBody = null
49
+	): ServerRequestInterface {
50
+		$serverParams  = $serverParams  ?? $_SERVER;
51
+		$queryParams   = $queryParams   ?? $_GET;
52
+		$cookieParams  = $cookieParams  ?? $_COOKIE;
53
+		$uploadedFiles = $uploadedFiles ?? $_FILES;
54
+		$parsedBody    = $parsedBody    ?? $_POST;
55 55
 
56
-        return new ServerRequest(
57
-            server_request_protocol_version($serverParams),
58
-            server_request_method($serverParams),
59
-            server_request_uri($serverParams),
60
-            server_request_headers($serverParams),
61
-            new PhpInputStream(),
62
-            $serverParams,
63
-            $queryParams,
64
-            $cookieParams,
65
-            server_request_files($uploadedFiles),
66
-            $parsedBody
67
-        );
68
-    }
56
+		return new ServerRequest(
57
+			server_request_protocol_version($serverParams),
58
+			server_request_method($serverParams),
59
+			server_request_uri($serverParams),
60
+			server_request_headers($serverParams),
61
+			new PhpInputStream(),
62
+			$serverParams,
63
+			$queryParams,
64
+			$cookieParams,
65
+			server_request_files($uploadedFiles),
66
+			$parsedBody
67
+		);
68
+	}
69 69
 
70
-    /**
71
-     * {@inheritdoc}
72
-     */
73
-    public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface
74
-    {
75
-        return new ServerRequest(
76
-            server_request_protocol_version($serverParams),
77
-            $method,
78
-            $uri,
79
-            server_request_headers($serverParams),
80
-            null, // body
81
-            $serverParams
82
-        );
83
-    }
70
+	/**
71
+	 * {@inheritdoc}
72
+	 */
73
+	public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface
74
+	{
75
+		return new ServerRequest(
76
+			server_request_protocol_version($serverParams),
77
+			$method,
78
+			$uri,
79
+			server_request_headers($serverParams),
80
+			null, // body
81
+			$serverParams
82
+		);
83
+	}
84 84
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@
 block discarded – undo
47 47
         ?array $uploadedFiles = null,
48 48
         ?array $parsedBody = null
49 49
     ): ServerRequestInterface {
50
-        $serverParams  = $serverParams  ?? $_SERVER;
51
-        $queryParams   = $queryParams   ?? $_GET;
52
-        $cookieParams  = $cookieParams  ?? $_COOKIE;
50
+        $serverParams  = $serverParams ?? $_SERVER;
51
+        $queryParams   = $queryParams ?? $_GET;
52
+        $cookieParams  = $cookieParams ?? $_COOKIE;
53 53
         $uploadedFiles = $uploadedFiles ?? $_FILES;
54
-        $parsedBody    = $parsedBody    ?? $_POST;
54
+        $parsedBody    = $parsedBody ?? $_POST;
55 55
 
56 56
         return new ServerRequest(
57 57
             server_request_protocol_version($serverParams),
Please login to merge, or discard this patch.
src/Response.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -262,7 +262,7 @@
 block discarded – undo
262 262
             throw new InvalidArgumentException('HTTP status code must be an integer');
263 263
         }
264 264
 
265
-        if (! ($statusCode >= 100 && $statusCode <= 599)) {
265
+        if (!($statusCode >= 100 && $statusCode <= 599)) {
266 266
             throw new InvalidArgumentException('Invalid HTTP status code');
267 267
         }
268 268
     }
Please login to merge, or discard this patch.
Indentation   +230 added lines, -230 removed lines patch added patch discarded remove patch
@@ -35,258 +35,258 @@
 block discarded – undo
35 35
 class Response extends Message implements ResponseInterface, StatusCodeInterface
36 36
 {
37 37
 
38
-    /**
39
-     * List of Reason Phrases
40
-     *
41
-     * @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
42
-     *
43
-     * @var array<int, string>
44
-     */
45
-    public const REASON_PHRASES = [
38
+	/**
39
+	 * List of Reason Phrases
40
+	 *
41
+	 * @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
42
+	 *
43
+	 * @var array<int, string>
44
+	 */
45
+	public const REASON_PHRASES = [
46 46
 
47
-        // 1xx
48
-        100 => 'Continue',
49
-        101 => 'Switching Protocols',
50
-        102 => 'Processing',
51
-        103 => 'Early Hints',
47
+		// 1xx
48
+		100 => 'Continue',
49
+		101 => 'Switching Protocols',
50
+		102 => 'Processing',
51
+		103 => 'Early Hints',
52 52
 
53
-        // 2xx
54
-        200 => 'OK',
55
-        201 => 'Created',
56
-        202 => 'Accepted',
57
-        203 => 'Non-Authoritative Information',
58
-        204 => 'No Content',
59
-        205 => 'Reset Content',
60
-        206 => 'Partial Content',
61
-        207 => 'Multi-Status',
62
-        208 => 'Already Reported',
63
-        226 => 'IM Used',
53
+		// 2xx
54
+		200 => 'OK',
55
+		201 => 'Created',
56
+		202 => 'Accepted',
57
+		203 => 'Non-Authoritative Information',
58
+		204 => 'No Content',
59
+		205 => 'Reset Content',
60
+		206 => 'Partial Content',
61
+		207 => 'Multi-Status',
62
+		208 => 'Already Reported',
63
+		226 => 'IM Used',
64 64
 
65
-        // 3xx
66
-        300 => 'Multiple Choices',
67
-        301 => 'Moved Permanently',
68
-        302 => 'Found',
69
-        303 => 'See Other',
70
-        304 => 'Not Modified',
71
-        305 => 'Use Proxy',
72
-        307 => 'Temporary Redirect',
73
-        308 => 'Permanent Redirect',
65
+		// 3xx
66
+		300 => 'Multiple Choices',
67
+		301 => 'Moved Permanently',
68
+		302 => 'Found',
69
+		303 => 'See Other',
70
+		304 => 'Not Modified',
71
+		305 => 'Use Proxy',
72
+		307 => 'Temporary Redirect',
73
+		308 => 'Permanent Redirect',
74 74
 
75
-        // 4xx
76
-        400 => 'Bad Request',
77
-        401 => 'Unauthorized',
78
-        402 => 'Payment Required',
79
-        403 => 'Forbidden',
80
-        404 => 'Not Found',
81
-        405 => 'Method Not Allowed',
82
-        406 => 'Not Acceptable',
83
-        407 => 'Proxy Authentication Required',
84
-        408 => 'Request Timeout',
85
-        409 => 'Conflict',
86
-        410 => 'Gone',
87
-        411 => 'Length Required',
88
-        412 => 'Precondition Failed',
89
-        413 => 'Payload Too Large',
90
-        414 => 'URI Too Long',
91
-        415 => 'Unsupported Media Type',
92
-        416 => 'Range Not Satisfiable',
93
-        417 => 'Expectation Failed',
94
-        421 => 'Misdirected Request',
95
-        422 => 'Unprocessable Entity',
96
-        423 => 'Locked',
97
-        424 => 'Failed Dependency',
98
-        425 => 'Too Early',
99
-        426 => 'Upgrade Required',
100
-        428 => 'Precondition Required',
101
-        429 => 'Too Many Requests',
102
-        431 => 'Request Header Fields Too Large',
103
-        451 => 'Unavailable For Legal Reasons',
75
+		// 4xx
76
+		400 => 'Bad Request',
77
+		401 => 'Unauthorized',
78
+		402 => 'Payment Required',
79
+		403 => 'Forbidden',
80
+		404 => 'Not Found',
81
+		405 => 'Method Not Allowed',
82
+		406 => 'Not Acceptable',
83
+		407 => 'Proxy Authentication Required',
84
+		408 => 'Request Timeout',
85
+		409 => 'Conflict',
86
+		410 => 'Gone',
87
+		411 => 'Length Required',
88
+		412 => 'Precondition Failed',
89
+		413 => 'Payload Too Large',
90
+		414 => 'URI Too Long',
91
+		415 => 'Unsupported Media Type',
92
+		416 => 'Range Not Satisfiable',
93
+		417 => 'Expectation Failed',
94
+		421 => 'Misdirected Request',
95
+		422 => 'Unprocessable Entity',
96
+		423 => 'Locked',
97
+		424 => 'Failed Dependency',
98
+		425 => 'Too Early',
99
+		426 => 'Upgrade Required',
100
+		428 => 'Precondition Required',
101
+		429 => 'Too Many Requests',
102
+		431 => 'Request Header Fields Too Large',
103
+		451 => 'Unavailable For Legal Reasons',
104 104
 
105
-        // 5xx
106
-        500 => 'Internal Server Error',
107
-        501 => 'Not Implemented',
108
-        502 => 'Bad Gateway',
109
-        503 => 'Service Unavailable',
110
-        504 => 'Gateway Timeout',
111
-        505 => 'HTTP Version Not Supported',
112
-        506 => 'Variant Also Negotiates',
113
-        507 => 'Insufficient Storage',
114
-        508 => 'Loop Detected',
115
-        510 => 'Not Extended',
116
-        511 => 'Network Authentication Required',
117
-    ];
105
+		// 5xx
106
+		500 => 'Internal Server Error',
107
+		501 => 'Not Implemented',
108
+		502 => 'Bad Gateway',
109
+		503 => 'Service Unavailable',
110
+		504 => 'Gateway Timeout',
111
+		505 => 'HTTP Version Not Supported',
112
+		506 => 'Variant Also Negotiates',
113
+		507 => 'Insufficient Storage',
114
+		508 => 'Loop Detected',
115
+		510 => 'Not Extended',
116
+		511 => 'Network Authentication Required',
117
+	];
118 118
 
119
-    /**
120
-     * Default response status code
121
-     *
122
-     * @var int
123
-     */
124
-    public const DEFAULT_STATUS_CODE = self::STATUS_OK;
119
+	/**
120
+	 * Default response status code
121
+	 *
122
+	 * @var int
123
+	 */
124
+	public const DEFAULT_STATUS_CODE = self::STATUS_OK;
125 125
 
126
-    /**
127
-     * Default response reason phrase
128
-     *
129
-     * @var string
130
-     */
131
-    public const DEFAULT_REASON_PHRASE = self::REASON_PHRASES[self::DEFAULT_STATUS_CODE];
126
+	/**
127
+	 * Default response reason phrase
128
+	 *
129
+	 * @var string
130
+	 */
131
+	public const DEFAULT_REASON_PHRASE = self::REASON_PHRASES[self::DEFAULT_STATUS_CODE];
132 132
 
133
-    /**
134
-     * Reason phrase for unknown status code
135
-     *
136
-     * @var string
137
-     */
138
-    public const UNKNOWN_STATUS_CODE_REASON_PHRASE = 'Unknown Status Code';
133
+	/**
134
+	 * Reason phrase for unknown status code
135
+	 *
136
+	 * @var string
137
+	 */
138
+	public const UNKNOWN_STATUS_CODE_REASON_PHRASE = 'Unknown Status Code';
139 139
 
140
-    /**
141
-     * The response's status code
142
-     *
143
-     * @var int
144
-     */
145
-    private int $statusCode = self::DEFAULT_STATUS_CODE;
140
+	/**
141
+	 * The response's status code
142
+	 *
143
+	 * @var int
144
+	 */
145
+	private int $statusCode = self::DEFAULT_STATUS_CODE;
146 146
 
147
-    /**
148
-     * The response's reason phrase
149
-     *
150
-     * @var string
151
-     */
152
-    private string $reasonPhrase = self::DEFAULT_REASON_PHRASE;
147
+	/**
148
+	 * The response's reason phrase
149
+	 *
150
+	 * @var string
151
+	 */
152
+	private string $reasonPhrase = self::DEFAULT_REASON_PHRASE;
153 153
 
154
-    /**
155
-     * Constrictor of the class
156
-     *
157
-     * @param int|null $statusCode
158
-     * @param string|null $reasonPhrase
159
-     * @param array<string, string|string[]>|null $headers
160
-     * @param StreamInterface|null $body
161
-     *
162
-     * @throws InvalidArgumentException
163
-     *         If one of the arguments isn't valid.
164
-     */
165
-    public function __construct(
166
-        ?int $statusCode = null,
167
-        ?string $reasonPhrase = null,
168
-        ?array $headers = null,
169
-        ?StreamInterface $body = null
170
-    ) {
171
-        if (isset($statusCode)) {
172
-            $this->setStatus($statusCode, $reasonPhrase ?? '');
173
-        }
154
+	/**
155
+	 * Constrictor of the class
156
+	 *
157
+	 * @param int|null $statusCode
158
+	 * @param string|null $reasonPhrase
159
+	 * @param array<string, string|string[]>|null $headers
160
+	 * @param StreamInterface|null $body
161
+	 *
162
+	 * @throws InvalidArgumentException
163
+	 *         If one of the arguments isn't valid.
164
+	 */
165
+	public function __construct(
166
+		?int $statusCode = null,
167
+		?string $reasonPhrase = null,
168
+		?array $headers = null,
169
+		?StreamInterface $body = null
170
+	) {
171
+		if (isset($statusCode)) {
172
+			$this->setStatus($statusCode, $reasonPhrase ?? '');
173
+		}
174 174
 
175
-        if (isset($headers)) {
176
-            $this->setHeaders($headers);
177
-        }
175
+		if (isset($headers)) {
176
+			$this->setHeaders($headers);
177
+		}
178 178
 
179
-        if (isset($body)) {
180
-            $this->setBody($body);
181
-        }
182
-    }
179
+		if (isset($body)) {
180
+			$this->setBody($body);
181
+		}
182
+	}
183 183
 
184
-    /**
185
-     * Gets the response's status code
186
-     *
187
-     * @return int
188
-     */
189
-    public function getStatusCode(): int
190
-    {
191
-        return $this->statusCode;
192
-    }
184
+	/**
185
+	 * Gets the response's status code
186
+	 *
187
+	 * @return int
188
+	 */
189
+	public function getStatusCode(): int
190
+	{
191
+		return $this->statusCode;
192
+	}
193 193
 
194
-    /**
195
-     * Gets the response's reason phrase
196
-     *
197
-     * @return string
198
-     */
199
-    public function getReasonPhrase(): string
200
-    {
201
-        return $this->reasonPhrase;
202
-    }
194
+	/**
195
+	 * Gets the response's reason phrase
196
+	 *
197
+	 * @return string
198
+	 */
199
+	public function getReasonPhrase(): string
200
+	{
201
+		return $this->reasonPhrase;
202
+	}
203 203
 
204
-    /**
205
-     * Creates a new instance of the response with the given status code
206
-     *
207
-     * @param int $code
208
-     * @param string $reasonPhrase
209
-     *
210
-     * @return static
211
-     *
212
-     * @throws InvalidArgumentException
213
-     *         If the status isn't valid.
214
-     */
215
-    public function withStatus($code, $reasonPhrase = ''): ResponseInterface
216
-    {
217
-        $clone = clone $this;
218
-        $clone->setStatus($code, $reasonPhrase);
204
+	/**
205
+	 * Creates a new instance of the response with the given status code
206
+	 *
207
+	 * @param int $code
208
+	 * @param string $reasonPhrase
209
+	 *
210
+	 * @return static
211
+	 *
212
+	 * @throws InvalidArgumentException
213
+	 *         If the status isn't valid.
214
+	 */
215
+	public function withStatus($code, $reasonPhrase = ''): ResponseInterface
216
+	{
217
+		$clone = clone $this;
218
+		$clone->setStatus($code, $reasonPhrase);
219 219
 
220
-        return $clone;
221
-    }
220
+		return $clone;
221
+	}
222 222
 
223
-    /**
224
-     * Sets the given status code to the response
225
-     *
226
-     * @param int $statusCode
227
-     * @param string $reasonPhrase
228
-     *
229
-     * @return void
230
-     *
231
-     * @throws InvalidArgumentException
232
-     *         If the status isn't valid.
233
-     */
234
-    final protected function setStatus($statusCode, $reasonPhrase): void
235
-    {
236
-        $this->validateStatusCode($statusCode);
237
-        $this->validateReasonPhrase($reasonPhrase);
223
+	/**
224
+	 * Sets the given status code to the response
225
+	 *
226
+	 * @param int $statusCode
227
+	 * @param string $reasonPhrase
228
+	 *
229
+	 * @return void
230
+	 *
231
+	 * @throws InvalidArgumentException
232
+	 *         If the status isn't valid.
233
+	 */
234
+	final protected function setStatus($statusCode, $reasonPhrase): void
235
+	{
236
+		$this->validateStatusCode($statusCode);
237
+		$this->validateReasonPhrase($reasonPhrase);
238 238
 
239
-        if ('' === $reasonPhrase) {
240
-            $reasonPhrase = self::REASON_PHRASES[$statusCode] ?? self::UNKNOWN_STATUS_CODE_REASON_PHRASE;
241
-        }
239
+		if ('' === $reasonPhrase) {
240
+			$reasonPhrase = self::REASON_PHRASES[$statusCode] ?? self::UNKNOWN_STATUS_CODE_REASON_PHRASE;
241
+		}
242 242
 
243
-        $this->statusCode = $statusCode;
244
-        $this->reasonPhrase = $reasonPhrase;
245
-    }
243
+		$this->statusCode = $statusCode;
244
+		$this->reasonPhrase = $reasonPhrase;
245
+	}
246 246
 
247
-    /**
248
-     * Validates the given status code
249
-     *
250
-     * @link https://tools.ietf.org/html/rfc7230#section-3.1.2
251
-     *
252
-     * @param mixed $statusCode
253
-     *
254
-     * @return void
255
-     *
256
-     * @throws InvalidArgumentException
257
-     *         If the status code isn't valid.
258
-     */
259
-    private function validateStatusCode($statusCode): void
260
-    {
261
-        if (!is_int($statusCode)) {
262
-            throw new InvalidArgumentException('HTTP status code must be an integer');
263
-        }
247
+	/**
248
+	 * Validates the given status code
249
+	 *
250
+	 * @link https://tools.ietf.org/html/rfc7230#section-3.1.2
251
+	 *
252
+	 * @param mixed $statusCode
253
+	 *
254
+	 * @return void
255
+	 *
256
+	 * @throws InvalidArgumentException
257
+	 *         If the status code isn't valid.
258
+	 */
259
+	private function validateStatusCode($statusCode): void
260
+	{
261
+		if (!is_int($statusCode)) {
262
+			throw new InvalidArgumentException('HTTP status code must be an integer');
263
+		}
264 264
 
265
-        if (! ($statusCode >= 100 && $statusCode <= 599)) {
266
-            throw new InvalidArgumentException('Invalid HTTP status code');
267
-        }
268
-    }
265
+		if (! ($statusCode >= 100 && $statusCode <= 599)) {
266
+			throw new InvalidArgumentException('Invalid HTTP status code');
267
+		}
268
+	}
269 269
 
270
-    /**
271
-     * Validates the given reason phrase
272
-     *
273
-     * @link https://tools.ietf.org/html/rfc7230#section-3.1.2
274
-     *
275
-     * @param mixed $reasonPhrase
276
-     *
277
-     * @return void
278
-     *
279
-     * @throws InvalidArgumentException
280
-     *         If the reason phrase isn't valid.
281
-     */
282
-    private function validateReasonPhrase($reasonPhrase): void
283
-    {
284
-        if (!is_string($reasonPhrase)) {
285
-            throw new InvalidArgumentException('HTTP reason phrase must be a string');
286
-        }
270
+	/**
271
+	 * Validates the given reason phrase
272
+	 *
273
+	 * @link https://tools.ietf.org/html/rfc7230#section-3.1.2
274
+	 *
275
+	 * @param mixed $reasonPhrase
276
+	 *
277
+	 * @return void
278
+	 *
279
+	 * @throws InvalidArgumentException
280
+	 *         If the reason phrase isn't valid.
281
+	 */
282
+	private function validateReasonPhrase($reasonPhrase): void
283
+	{
284
+		if (!is_string($reasonPhrase)) {
285
+			throw new InvalidArgumentException('HTTP reason phrase must be a string');
286
+		}
287 287
 
288
-        if (!preg_match(Header::RFC7230_VALID_FIELD_VALUE, $reasonPhrase)) {
289
-            throw new InvalidArgumentException('Invalid HTTP reason phrase');
290
-        }
291
-    }
288
+		if (!preg_match(Header::RFC7230_VALID_FIELD_VALUE, $reasonPhrase)) {
289
+			throw new InvalidArgumentException('Invalid HTTP reason phrase');
290
+		}
291
+	}
292 292
 }
Please login to merge, or discard this patch.
src/StreamFactory.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -27,35 +27,35 @@
 block discarded – undo
27 27
 class StreamFactory implements StreamFactoryInterface
28 28
 {
29 29
 
30
-    /**
31
-     * {@inheritdoc}
32
-     */
33
-    public function createStream(string $content = ''): StreamInterface
34
-    {
35
-        $stream = new PhpTempStream();
36
-        if ($content === '') {
37
-            return $stream;
38
-        }
39
-
40
-        $stream->write($content);
41
-        $stream->rewind();
42
-
43
-        return $stream;
44
-    }
45
-
46
-    /**
47
-     * {@inheritdoc}
48
-     */
49
-    public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface
50
-    {
51
-        return new FileStream($filename, $mode);
52
-    }
53
-
54
-    /**
55
-     * {@inheritdoc}
56
-     */
57
-    public function createStreamFromResource($resource): StreamInterface
58
-    {
59
-        return new Stream($resource);
60
-    }
30
+	/**
31
+	 * {@inheritdoc}
32
+	 */
33
+	public function createStream(string $content = ''): StreamInterface
34
+	{
35
+		$stream = new PhpTempStream();
36
+		if ($content === '') {
37
+			return $stream;
38
+		}
39
+
40
+		$stream->write($content);
41
+		$stream->rewind();
42
+
43
+		return $stream;
44
+	}
45
+
46
+	/**
47
+	 * {@inheritdoc}
48
+	 */
49
+	public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface
50
+	{
51
+		return new FileStream($filename, $mode);
52
+	}
53
+
54
+	/**
55
+	 * {@inheritdoc}
56
+	 */
57
+	public function createStreamFromResource($resource): StreamInterface
58
+	{
59
+		return new Stream($resource);
60
+	}
61 61
 }
Please login to merge, or discard this patch.
src/UriFactory.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@
 block discarded – undo
25 25
 class UriFactory implements UriFactoryInterface
26 26
 {
27 27
 
28
-    /**
29
-     * {@inheritdoc}
30
-     */
31
-    public function createUri(string $uri = ''): UriInterface
32
-    {
33
-        return new Uri($uri);
34
-    }
28
+	/**
29
+	 * {@inheritdoc}
30
+	 */
31
+	public function createUri(string $uri = ''): UriInterface
32
+	{
33
+		return new Uri($uri);
34
+	}
35 35
 }
Please login to merge, or discard this patch.
src/HeaderInterface.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -26,26 +26,26 @@
 block discarded – undo
26 26
 interface HeaderInterface extends IteratorAggregate
27 27
 {
28 28
 
29
-    /**
30
-     * Gets the header field name
31
-     *
32
-     * @return string
33
-     */
34
-    public function getFieldName(): string;
29
+	/**
30
+	 * Gets the header field name
31
+	 *
32
+	 * @return string
33
+	 */
34
+	public function getFieldName(): string;
35 35
 
36
-    /**
37
-     * Gets the header field value
38
-     *
39
-     * @return string
40
-     */
41
-    public function getFieldValue(): string;
36
+	/**
37
+	 * Gets the header field value
38
+	 *
39
+	 * @return string
40
+	 */
41
+	public function getFieldValue(): string;
42 42
 
43
-    /**
44
-     * Converts the header field to a string
45
-     *
46
-     * @link http://php.net/manual/en/language.oop5.magic.php#object.tostring
47
-     *
48
-     * @return string
49
-     */
50
-    public function __toString(): string;
43
+	/**
44
+	 * Converts the header field to a string
45
+	 *
46
+	 * @link http://php.net/manual/en/language.oop5.magic.php#object.tostring
47
+	 *
48
+	 * @return string
49
+	 */
50
+	public function __toString(): string;
51 51
 }
Please login to merge, or discard this patch.
src/RequestFactory.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@
 block discarded – undo
25 25
 class RequestFactory implements RequestFactoryInterface
26 26
 {
27 27
 
28
-    /**
29
-     * {@inheritdoc}
30
-     */
31
-    public function createRequest(string $method, $uri): RequestInterface
32
-    {
33
-        return new Request($method, $uri);
34
-    }
28
+	/**
29
+	 * {@inheritdoc}
30
+	 */
31
+	public function createRequest(string $method, $uri): RequestInterface
32
+	{
33
+		return new Request($method, $uri);
34
+	}
35 35
 }
Please login to merge, or discard this patch.
src/Uri/Component/Scheme.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -31,53 +31,53 @@
 block discarded – undo
31 31
 final class Scheme implements ComponentInterface
32 32
 {
33 33
 
34
-    /**
35
-     * Regular expression to validate the component value
36
-     *
37
-     * @var string
38
-     */
39
-    private const VALIDATE_REGEX = '/^(?:[A-Za-z][0-9A-Za-z\+\-\.]*)?$/';
34
+	/**
35
+	 * Regular expression to validate the component value
36
+	 *
37
+	 * @var string
38
+	 */
39
+	private const VALIDATE_REGEX = '/^(?:[A-Za-z][0-9A-Za-z\+\-\.]*)?$/';
40 40
 
41
-    /**
42
-     * The component value
43
-     *
44
-     * @var string
45
-     */
46
-    private string $value = '';
41
+	/**
42
+	 * The component value
43
+	 *
44
+	 * @var string
45
+	 */
46
+	private string $value = '';
47 47
 
48
-    /**
49
-     * Constructor of the class
50
-     *
51
-     * @param mixed $value
52
-     *
53
-     * @throws InvalidUriComponentException
54
-     *         If the component isn't valid.
55
-     */
56
-    public function __construct($value)
57
-    {
58
-        if ($value === '') {
59
-            return;
60
-        }
48
+	/**
49
+	 * Constructor of the class
50
+	 *
51
+	 * @param mixed $value
52
+	 *
53
+	 * @throws InvalidUriComponentException
54
+	 *         If the component isn't valid.
55
+	 */
56
+	public function __construct($value)
57
+	{
58
+		if ($value === '') {
59
+			return;
60
+		}
61 61
 
62
-        if (!is_string($value)) {
63
-            throw new InvalidUriComponentException('URI component "scheme" must be a string');
64
-        }
62
+		if (!is_string($value)) {
63
+			throw new InvalidUriComponentException('URI component "scheme" must be a string');
64
+		}
65 65
 
66
-        if (!preg_match(self::VALIDATE_REGEX, $value)) {
67
-            throw new InvalidUriComponentException('Invalid URI component "scheme"');
68
-        }
66
+		if (!preg_match(self::VALIDATE_REGEX, $value)) {
67
+			throw new InvalidUriComponentException('Invalid URI component "scheme"');
68
+		}
69 69
 
70
-        // the component is case-insensitive...
71
-        $this->value = strtolower($value);
72
-    }
70
+		// the component is case-insensitive...
71
+		$this->value = strtolower($value);
72
+	}
73 73
 
74
-    /**
75
-     * {@inheritdoc}
76
-     *
77
-     * @return string
78
-     */
79
-    public function getValue(): string
80
-    {
81
-        return $this->value;
82
-    }
74
+	/**
75
+	 * {@inheritdoc}
76
+	 *
77
+	 * @return string
78
+	 */
79
+	public function getValue(): string
80
+	{
81
+		return $this->value;
82
+	}
83 83
 }
Please login to merge, or discard this patch.
src/Uri/Component/Fragment.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -31,52 +31,52 @@
 block discarded – undo
31 31
 final class Fragment implements ComponentInterface
32 32
 {
33 33
 
34
-    /**
35
-     * Regular expression to normalize the component value
36
-     *
37
-     * @var string
38
-     */
39
-    private const NORMALIZE_REGEX = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=\:@\/\?]+)|(.?))/u';
34
+	/**
35
+	 * Regular expression to normalize the component value
36
+	 *
37
+	 * @var string
38
+	 */
39
+	private const NORMALIZE_REGEX = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=\:@\/\?]+)|(.?))/u';
40 40
 
41
-    /**
42
-     * The component value
43
-     *
44
-     * @var string
45
-     */
46
-    private string $value = '';
41
+	/**
42
+	 * The component value
43
+	 *
44
+	 * @var string
45
+	 */
46
+	private string $value = '';
47 47
 
48
-    /**
49
-     * Constructor of the class
50
-     *
51
-     * @param mixed $value
52
-     *
53
-     * @throws InvalidUriComponentException
54
-     *         If the component isn't valid.
55
-     */
56
-    public function __construct($value)
57
-    {
58
-        if ($value === '') {
59
-            return;
60
-        }
48
+	/**
49
+	 * Constructor of the class
50
+	 *
51
+	 * @param mixed $value
52
+	 *
53
+	 * @throws InvalidUriComponentException
54
+	 *         If the component isn't valid.
55
+	 */
56
+	public function __construct($value)
57
+	{
58
+		if ($value === '') {
59
+			return;
60
+		}
61 61
 
62
-        if (!is_string($value)) {
63
-            throw new InvalidUriComponentException('URI component "fragment" must be a string');
64
-        }
62
+		if (!is_string($value)) {
63
+			throw new InvalidUriComponentException('URI component "fragment" must be a string');
64
+		}
65 65
 
66
-        $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function (array $match): string {
67
-            /** @var array{0: string, 1?: string} $match */
66
+		$this->value = preg_replace_callback(self::NORMALIZE_REGEX, function (array $match): string {
67
+			/** @var array{0: string, 1?: string} $match */
68 68
 
69
-            return isset($match[1]) ? rawurlencode($match[1]) : $match[0];
70
-        }, $value);
71
-    }
69
+			return isset($match[1]) ? rawurlencode($match[1]) : $match[0];
70
+		}, $value);
71
+	}
72 72
 
73
-    /**
74
-     * {@inheritdoc}
75
-     *
76
-     * @return string
77
-     */
78
-    public function getValue(): string
79
-    {
80
-        return $this->value;
81
-    }
73
+	/**
74
+	 * {@inheritdoc}
75
+	 *
76
+	 * @return string
77
+	 */
78
+	public function getValue(): string
79
+	{
80
+		return $this->value;
81
+	}
82 82
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
             throw new InvalidUriComponentException('URI component "fragment" must be a string');
64 64
         }
65 65
 
66
-        $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function (array $match): string {
66
+        $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function(array $match): string {
67 67
             /** @var array{0: string, 1?: string} $match */
68 68
 
69 69
             return isset($match[1]) ? rawurlencode($match[1]) : $match[0];
Please login to merge, or discard this patch.
src/Uri/Component/ComponentInterface.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@
 block discarded – undo
17 17
 interface ComponentInterface
18 18
 {
19 19
 
20
-    /**
21
-     * Gets the component value
22
-     *
23
-     * @return mixed
24
-     */
25
-    public function getValue();
20
+	/**
21
+	 * Gets the component value
22
+	 *
23
+	 * @return mixed
24
+	 */
25
+	public function getValue();
26 26
 }
Please login to merge, or discard this patch.