Passed
Pull Request — master (#31)
by Anatoly
39:30
created
src/Header/CookieHeader.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -32,34 +32,34 @@
 block discarded – undo
32 32
 class CookieHeader extends Header
33 33
 {
34 34
 
35
-    /**
36
-     * @var array
37
-     */
38
-    private array $value;
35
+	/**
36
+	 * @var array
37
+	 */
38
+	private array $value;
39 39
 
40
-    /**
41
-     * Constructor of the class
42
-     *
43
-     * @param array $value
44
-     */
45
-    public function __construct(array $value = [])
46
-    {
47
-        $this->value = $value;
48
-    }
40
+	/**
41
+	 * Constructor of the class
42
+	 *
43
+	 * @param array $value
44
+	 */
45
+	public function __construct(array $value = [])
46
+	{
47
+		$this->value = $value;
48
+	}
49 49
 
50
-    /**
51
-     * {@inheritdoc}
52
-     */
53
-    public function getFieldName(): string
54
-    {
55
-        return 'Cookie';
56
-    }
50
+	/**
51
+	 * {@inheritdoc}
52
+	 */
53
+	public function getFieldName(): string
54
+	{
55
+		return 'Cookie';
56
+	}
57 57
 
58
-    /**
59
-     * {@inheritdoc}
60
-     */
61
-    public function getFieldValue(): string
62
-    {
63
-        return http_build_query($this->value, '', '; ', PHP_QUERY_RFC3986);
64
-    }
58
+	/**
59
+	 * {@inheritdoc}
60
+	 */
61
+	public function getFieldValue(): string
62
+	{
63
+		return http_build_query($this->value, '', '; ', PHP_QUERY_RFC3986);
64
+	}
65 65
 }
Please login to merge, or discard this patch.
src/Header/SunsetHeader.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -24,34 +24,34 @@
 block discarded – undo
24 24
 class SunsetHeader extends Header
25 25
 {
26 26
 
27
-    /**
28
-     * @var DateTimeInterface
29
-     */
30
-    private DateTimeInterface $timestamp;
31
-
32
-    /**
33
-     * Constructor of the class
34
-     *
35
-     * @param DateTimeInterface $timestamp
36
-     */
37
-    public function __construct(DateTimeInterface $timestamp)
38
-    {
39
-        $this->timestamp = $timestamp;
40
-    }
41
-
42
-    /**
43
-     * {@inheritdoc}
44
-     */
45
-    public function getFieldName(): string
46
-    {
47
-        return 'Sunset';
48
-    }
49
-
50
-    /**
51
-     * {@inheritdoc}
52
-     */
53
-    public function getFieldValue(): string
54
-    {
55
-        return $this->formatDateTime($this->timestamp);
56
-    }
27
+	/**
28
+	 * @var DateTimeInterface
29
+	 */
30
+	private DateTimeInterface $timestamp;
31
+
32
+	/**
33
+	 * Constructor of the class
34
+	 *
35
+	 * @param DateTimeInterface $timestamp
36
+	 */
37
+	public function __construct(DateTimeInterface $timestamp)
38
+	{
39
+		$this->timestamp = $timestamp;
40
+	}
41
+
42
+	/**
43
+	 * {@inheritdoc}
44
+	 */
45
+	public function getFieldName(): string
46
+	{
47
+		return 'Sunset';
48
+	}
49
+
50
+	/**
51
+	 * {@inheritdoc}
52
+	 */
53
+	public function getFieldValue(): string
54
+	{
55
+		return $this->formatDateTime($this->timestamp);
56
+	}
57 57
 }
Please login to merge, or discard this patch.
src/Header/ContentSecurityPolicyReportOnlyHeader.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@
 block discarded – undo
17 17
 class ContentSecurityPolicyReportOnlyHeader extends ContentSecurityPolicyHeader
18 18
 {
19 19
 
20
-    /**
21
-     * {@inheritdoc}
22
-     */
23
-    public function getFieldName(): string
24
-    {
25
-        return 'Content-Security-Policy-Report-Only';
26
-    }
20
+	/**
21
+	 * {@inheritdoc}
22
+	 */
23
+	public function getFieldName(): string
24
+	{
25
+		return 'Content-Security-Policy-Report-Only';
26
+	}
27 27
 }
Please login to merge, or discard this patch.
src/Header/AccessControlAllowCredentialsHeader.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -22,19 +22,19 @@
 block discarded – undo
22 22
 class AccessControlAllowCredentialsHeader extends Header
23 23
 {
24 24
 
25
-    /**
26
-     * {@inheritdoc}
27
-     */
28
-    public function getFieldName(): string
29
-    {
30
-        return 'Access-Control-Allow-Credentials';
31
-    }
25
+	/**
26
+	 * {@inheritdoc}
27
+	 */
28
+	public function getFieldName(): string
29
+	{
30
+		return 'Access-Control-Allow-Credentials';
31
+	}
32 32
 
33
-    /**
34
-     * {@inheritdoc}
35
-     */
36
-    public function getFieldValue(): string
37
-    {
38
-        return 'true';
39
-    }
33
+	/**
34
+	 * {@inheritdoc}
35
+	 */
36
+	public function getFieldValue(): string
37
+	{
38
+		return 'true';
39
+	}
40 40
 }
Please login to merge, or discard this patch.
src/ServerRequest.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -358,8 +358,8 @@
 block discarded – undo
358 358
          *
359 359
          * @psalm-suppress MissingClosureParamType
360 360
          */
361
-        array_walk_recursive($files, static function ($file): void {
362
-            if (! ($file instanceof UploadedFileInterface)) {
361
+        array_walk_recursive($files, static function($file): void {
362
+            if (!($file instanceof UploadedFileInterface)) {
363 363
                 throw new InvalidArgumentException('Invalid uploaded files');
364 364
             }
365 365
         });
Please login to merge, or discard this patch.
Indentation   +350 added lines, -350 removed lines patch added patch discarded remove patch
@@ -35,354 +35,354 @@
 block discarded – undo
35 35
 class ServerRequest extends Request implements ServerRequestInterface
36 36
 {
37 37
 
38
-    /**
39
-     * The server parameters
40
-     *
41
-     * @var array
42
-     */
43
-    private array $serverParams;
44
-
45
-    /**
46
-     * The request's query parameters
47
-     *
48
-     * @var array
49
-     */
50
-    private array $queryParams;
51
-
52
-    /**
53
-     * The request's cookie parameters
54
-     *
55
-     * @var array
56
-     */
57
-    private array $cookieParams;
58
-
59
-    /**
60
-     * The request's uploaded files
61
-     *
62
-     * @var array
63
-     */
64
-    private array $uploadedFiles;
65
-
66
-    /**
67
-     * The request's parsed body
68
-     *
69
-     * @var array|object|null
70
-     */
71
-    private $parsedBody;
72
-
73
-    /**
74
-     * The request attributes
75
-     *
76
-     * @var array
77
-     */
78
-    private array $attributes;
79
-
80
-    /**
81
-     * Constructor of the class
82
-     *
83
-     * @param string|null $protocolVersion
84
-     * @param string|null $method
85
-     * @param mixed $uri
86
-     * @param array<string, string|string[]>|null $headers
87
-     * @param StreamInterface|null $body
88
-     *
89
-     * @param array $serverParams
90
-     * @param array $queryParams
91
-     * @param array $cookieParams
92
-     * @param array $uploadedFiles
93
-     * @param array|object|null $parsedBody
94
-     * @param array $attributes
95
-     *
96
-     * @throws InvalidArgumentException
97
-     *         If one of the arguments isn't valid.
98
-     */
99
-    public function __construct(
100
-        ?string $protocolVersion = null,
101
-        ?string $method = null,
102
-        $uri = null,
103
-        ?array $headers = null,
104
-        ?StreamInterface $body = null,
105
-        array $serverParams = [],
106
-        array $queryParams = [],
107
-        array $cookieParams = [],
108
-        array $uploadedFiles = [],
109
-        $parsedBody = null,
110
-        array $attributes = []
111
-    ) {
112
-        if (isset($protocolVersion)) {
113
-            $this->setProtocolVersion($protocolVersion);
114
-        }
115
-
116
-        parent::__construct($method, $uri, $headers, $body);
117
-
118
-        $this->serverParams = $serverParams;
119
-        $this->queryParams = $queryParams;
120
-        $this->cookieParams = $cookieParams;
121
-        $this->setUploadedFiles($uploadedFiles);
122
-        $this->setParsedBody($parsedBody);
123
-        $this->attributes = $attributes;
124
-    }
125
-
126
-    /**
127
-     * Gets the server parameters
128
-     *
129
-     * @return array
130
-     */
131
-    public function getServerParams(): array
132
-    {
133
-        return $this->serverParams;
134
-    }
135
-
136
-    /**
137
-     * Gets the request's query parameters
138
-     *
139
-     * @return array
140
-     */
141
-    public function getQueryParams(): array
142
-    {
143
-        return $this->queryParams;
144
-    }
145
-
146
-    /**
147
-     * Creates a new instance of the request with the given query parameters
148
-     *
149
-     * @param array $query
150
-     *
151
-     * @return static
152
-     */
153
-    public function withQueryParams(array $query): ServerRequestInterface
154
-    {
155
-        $clone = clone $this;
156
-        $clone->queryParams = $query;
157
-
158
-        return $clone;
159
-    }
160
-
161
-    /**
162
-     * Gets the request's cookie parameters
163
-     *
164
-     * @return array
165
-     */
166
-    public function getCookieParams(): array
167
-    {
168
-        return $this->cookieParams;
169
-    }
170
-
171
-    /**
172
-     * Creates a new instance of the request with the given cookie parameters
173
-     *
174
-     * @param array $cookies
175
-     *
176
-     * @return static
177
-     */
178
-    public function withCookieParams(array $cookies): ServerRequestInterface
179
-    {
180
-        $clone = clone $this;
181
-        $clone->cookieParams = $cookies;
182
-
183
-        return $clone;
184
-    }
185
-
186
-    /**
187
-     * Gets the request's uploaded files
188
-     *
189
-     * @return array
190
-     */
191
-    public function getUploadedFiles(): array
192
-    {
193
-        return $this->uploadedFiles;
194
-    }
195
-
196
-    /**
197
-     * Creates a new instance of the request with the given uploaded files
198
-     *
199
-     * @param array $uploadedFiles
200
-     *
201
-     * @return static
202
-     *
203
-     * @throws InvalidArgumentException
204
-     *         If one of the files isn't valid.
205
-     */
206
-    public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface
207
-    {
208
-        $clone = clone $this;
209
-        $clone->setUploadedFiles($uploadedFiles);
210
-
211
-        return $clone;
212
-    }
213
-
214
-    /**
215
-     * Gets the request's parsed body
216
-     *
217
-     * @return array|object|null
218
-     */
219
-    public function getParsedBody()
220
-    {
221
-        return $this->parsedBody;
222
-    }
223
-
224
-    /**
225
-     * Creates a new instance of the request with the given parsed body
226
-     *
227
-     * @param array|object|null $data
228
-     *
229
-     * @return static
230
-     *
231
-     * @throws InvalidArgumentException
232
-     *         If the data isn't valid.
233
-     */
234
-    public function withParsedBody($data): ServerRequestInterface
235
-    {
236
-        $clone = clone $this;
237
-        $clone->setParsedBody($data);
238
-
239
-        return $clone;
240
-    }
241
-
242
-    /**
243
-     * Gets the request attributes
244
-     *
245
-     * @return array
246
-     */
247
-    public function getAttributes(): array
248
-    {
249
-        return $this->attributes;
250
-    }
251
-
252
-    /**
253
-     * Gets the request's attribute value by the given name
254
-     *
255
-     * Returns the default value if the attribute wasn't found.
256
-     *
257
-     * @param array-key $name
258
-     * @param mixed $default
259
-     *
260
-     * @return mixed
261
-     */
262
-    public function getAttribute($name, $default = null)
263
-    {
264
-        if (!array_key_exists($name, $this->attributes)) {
265
-            return $default;
266
-        }
267
-
268
-        return $this->attributes[$name];
269
-    }
270
-
271
-    /**
272
-     * Creates a new instance of the request with the given attribute
273
-     *
274
-     * @param array-key $name
275
-     * @param mixed $value
276
-     *
277
-     * @return static
278
-     */
279
-    public function withAttribute($name, $value): ServerRequestInterface
280
-    {
281
-        $clone = clone $this;
282
-        $clone->attributes[$name] = $value;
283
-
284
-        return $clone;
285
-    }
286
-
287
-    /**
288
-     * Creates a new instance of the request without an attribute with the given name
289
-     *
290
-     * @param array-key $name
291
-     *
292
-     * @return static
293
-     */
294
-    public function withoutAttribute($name): ServerRequestInterface
295
-    {
296
-        $clone = clone $this;
297
-        unset($clone->attributes[$name]);
298
-
299
-        return $clone;
300
-    }
301
-
302
-    /**
303
-     * Sets the given uploaded files to the request
304
-     *
305
-     * @param array $files
306
-     *
307
-     * @return void
308
-     *
309
-     * @throws InvalidArgumentException
310
-     *         If one of the files isn't valid.
311
-     */
312
-    final protected function setUploadedFiles(array $files): void
313
-    {
314
-        $this->validateUploadedFiles($files);
315
-
316
-        $this->uploadedFiles = $files;
317
-    }
318
-
319
-    /**
320
-     * Sets the given parsed body to the request
321
-     *
322
-     * @param array|object|null $data
323
-     *
324
-     * @return void
325
-     *
326
-     * @throws InvalidArgumentException
327
-     *         If the parsed body isn't valid.
328
-     */
329
-    final protected function setParsedBody($data): void
330
-    {
331
-        $this->validateParsedBody($data);
332
-
333
-        $this->parsedBody = $data;
334
-    }
335
-
336
-    /**
337
-     * Validates the given uploaded files
338
-     *
339
-     * @param array $files
340
-     *
341
-     * @return void
342
-     *
343
-     * @throws InvalidArgumentException
344
-     *         If one of the files isn't valid.
345
-     */
346
-    private function validateUploadedFiles(array $files): void
347
-    {
348
-        if ([] === $files) {
349
-            return;
350
-        }
351
-
352
-        /**
353
-         * @param mixed $file
354
-         *
355
-         * @return void
356
-         *
357
-         * @throws InvalidArgumentException
358
-         *
359
-         * @psalm-suppress MissingClosureParamType
360
-         */
361
-        array_walk_recursive($files, static function ($file): void {
362
-            if (! ($file instanceof UploadedFileInterface)) {
363
-                throw new InvalidArgumentException('Invalid uploaded files');
364
-            }
365
-        });
366
-    }
367
-
368
-    /**
369
-     * Validates the given parsed body
370
-     *
371
-     * @param mixed $data
372
-     *
373
-     * @return void
374
-     *
375
-     * @throws InvalidArgumentException
376
-     *         If the parsed body isn't valid.
377
-     */
378
-    private function validateParsedBody($data): void
379
-    {
380
-        if (null === $data) {
381
-            return;
382
-        }
383
-
384
-        if (!is_array($data) && !is_object($data)) {
385
-            throw new InvalidArgumentException('Invalid parsed body');
386
-        }
387
-    }
38
+	/**
39
+	 * The server parameters
40
+	 *
41
+	 * @var array
42
+	 */
43
+	private array $serverParams;
44
+
45
+	/**
46
+	 * The request's query parameters
47
+	 *
48
+	 * @var array
49
+	 */
50
+	private array $queryParams;
51
+
52
+	/**
53
+	 * The request's cookie parameters
54
+	 *
55
+	 * @var array
56
+	 */
57
+	private array $cookieParams;
58
+
59
+	/**
60
+	 * The request's uploaded files
61
+	 *
62
+	 * @var array
63
+	 */
64
+	private array $uploadedFiles;
65
+
66
+	/**
67
+	 * The request's parsed body
68
+	 *
69
+	 * @var array|object|null
70
+	 */
71
+	private $parsedBody;
72
+
73
+	/**
74
+	 * The request attributes
75
+	 *
76
+	 * @var array
77
+	 */
78
+	private array $attributes;
79
+
80
+	/**
81
+	 * Constructor of the class
82
+	 *
83
+	 * @param string|null $protocolVersion
84
+	 * @param string|null $method
85
+	 * @param mixed $uri
86
+	 * @param array<string, string|string[]>|null $headers
87
+	 * @param StreamInterface|null $body
88
+	 *
89
+	 * @param array $serverParams
90
+	 * @param array $queryParams
91
+	 * @param array $cookieParams
92
+	 * @param array $uploadedFiles
93
+	 * @param array|object|null $parsedBody
94
+	 * @param array $attributes
95
+	 *
96
+	 * @throws InvalidArgumentException
97
+	 *         If one of the arguments isn't valid.
98
+	 */
99
+	public function __construct(
100
+		?string $protocolVersion = null,
101
+		?string $method = null,
102
+		$uri = null,
103
+		?array $headers = null,
104
+		?StreamInterface $body = null,
105
+		array $serverParams = [],
106
+		array $queryParams = [],
107
+		array $cookieParams = [],
108
+		array $uploadedFiles = [],
109
+		$parsedBody = null,
110
+		array $attributes = []
111
+	) {
112
+		if (isset($protocolVersion)) {
113
+			$this->setProtocolVersion($protocolVersion);
114
+		}
115
+
116
+		parent::__construct($method, $uri, $headers, $body);
117
+
118
+		$this->serverParams = $serverParams;
119
+		$this->queryParams = $queryParams;
120
+		$this->cookieParams = $cookieParams;
121
+		$this->setUploadedFiles($uploadedFiles);
122
+		$this->setParsedBody($parsedBody);
123
+		$this->attributes = $attributes;
124
+	}
125
+
126
+	/**
127
+	 * Gets the server parameters
128
+	 *
129
+	 * @return array
130
+	 */
131
+	public function getServerParams(): array
132
+	{
133
+		return $this->serverParams;
134
+	}
135
+
136
+	/**
137
+	 * Gets the request's query parameters
138
+	 *
139
+	 * @return array
140
+	 */
141
+	public function getQueryParams(): array
142
+	{
143
+		return $this->queryParams;
144
+	}
145
+
146
+	/**
147
+	 * Creates a new instance of the request with the given query parameters
148
+	 *
149
+	 * @param array $query
150
+	 *
151
+	 * @return static
152
+	 */
153
+	public function withQueryParams(array $query): ServerRequestInterface
154
+	{
155
+		$clone = clone $this;
156
+		$clone->queryParams = $query;
157
+
158
+		return $clone;
159
+	}
160
+
161
+	/**
162
+	 * Gets the request's cookie parameters
163
+	 *
164
+	 * @return array
165
+	 */
166
+	public function getCookieParams(): array
167
+	{
168
+		return $this->cookieParams;
169
+	}
170
+
171
+	/**
172
+	 * Creates a new instance of the request with the given cookie parameters
173
+	 *
174
+	 * @param array $cookies
175
+	 *
176
+	 * @return static
177
+	 */
178
+	public function withCookieParams(array $cookies): ServerRequestInterface
179
+	{
180
+		$clone = clone $this;
181
+		$clone->cookieParams = $cookies;
182
+
183
+		return $clone;
184
+	}
185
+
186
+	/**
187
+	 * Gets the request's uploaded files
188
+	 *
189
+	 * @return array
190
+	 */
191
+	public function getUploadedFiles(): array
192
+	{
193
+		return $this->uploadedFiles;
194
+	}
195
+
196
+	/**
197
+	 * Creates a new instance of the request with the given uploaded files
198
+	 *
199
+	 * @param array $uploadedFiles
200
+	 *
201
+	 * @return static
202
+	 *
203
+	 * @throws InvalidArgumentException
204
+	 *         If one of the files isn't valid.
205
+	 */
206
+	public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface
207
+	{
208
+		$clone = clone $this;
209
+		$clone->setUploadedFiles($uploadedFiles);
210
+
211
+		return $clone;
212
+	}
213
+
214
+	/**
215
+	 * Gets the request's parsed body
216
+	 *
217
+	 * @return array|object|null
218
+	 */
219
+	public function getParsedBody()
220
+	{
221
+		return $this->parsedBody;
222
+	}
223
+
224
+	/**
225
+	 * Creates a new instance of the request with the given parsed body
226
+	 *
227
+	 * @param array|object|null $data
228
+	 *
229
+	 * @return static
230
+	 *
231
+	 * @throws InvalidArgumentException
232
+	 *         If the data isn't valid.
233
+	 */
234
+	public function withParsedBody($data): ServerRequestInterface
235
+	{
236
+		$clone = clone $this;
237
+		$clone->setParsedBody($data);
238
+
239
+		return $clone;
240
+	}
241
+
242
+	/**
243
+	 * Gets the request attributes
244
+	 *
245
+	 * @return array
246
+	 */
247
+	public function getAttributes(): array
248
+	{
249
+		return $this->attributes;
250
+	}
251
+
252
+	/**
253
+	 * Gets the request's attribute value by the given name
254
+	 *
255
+	 * Returns the default value if the attribute wasn't found.
256
+	 *
257
+	 * @param array-key $name
258
+	 * @param mixed $default
259
+	 *
260
+	 * @return mixed
261
+	 */
262
+	public function getAttribute($name, $default = null)
263
+	{
264
+		if (!array_key_exists($name, $this->attributes)) {
265
+			return $default;
266
+		}
267
+
268
+		return $this->attributes[$name];
269
+	}
270
+
271
+	/**
272
+	 * Creates a new instance of the request with the given attribute
273
+	 *
274
+	 * @param array-key $name
275
+	 * @param mixed $value
276
+	 *
277
+	 * @return static
278
+	 */
279
+	public function withAttribute($name, $value): ServerRequestInterface
280
+	{
281
+		$clone = clone $this;
282
+		$clone->attributes[$name] = $value;
283
+
284
+		return $clone;
285
+	}
286
+
287
+	/**
288
+	 * Creates a new instance of the request without an attribute with the given name
289
+	 *
290
+	 * @param array-key $name
291
+	 *
292
+	 * @return static
293
+	 */
294
+	public function withoutAttribute($name): ServerRequestInterface
295
+	{
296
+		$clone = clone $this;
297
+		unset($clone->attributes[$name]);
298
+
299
+		return $clone;
300
+	}
301
+
302
+	/**
303
+	 * Sets the given uploaded files to the request
304
+	 *
305
+	 * @param array $files
306
+	 *
307
+	 * @return void
308
+	 *
309
+	 * @throws InvalidArgumentException
310
+	 *         If one of the files isn't valid.
311
+	 */
312
+	final protected function setUploadedFiles(array $files): void
313
+	{
314
+		$this->validateUploadedFiles($files);
315
+
316
+		$this->uploadedFiles = $files;
317
+	}
318
+
319
+	/**
320
+	 * Sets the given parsed body to the request
321
+	 *
322
+	 * @param array|object|null $data
323
+	 *
324
+	 * @return void
325
+	 *
326
+	 * @throws InvalidArgumentException
327
+	 *         If the parsed body isn't valid.
328
+	 */
329
+	final protected function setParsedBody($data): void
330
+	{
331
+		$this->validateParsedBody($data);
332
+
333
+		$this->parsedBody = $data;
334
+	}
335
+
336
+	/**
337
+	 * Validates the given uploaded files
338
+	 *
339
+	 * @param array $files
340
+	 *
341
+	 * @return void
342
+	 *
343
+	 * @throws InvalidArgumentException
344
+	 *         If one of the files isn't valid.
345
+	 */
346
+	private function validateUploadedFiles(array $files): void
347
+	{
348
+		if ([] === $files) {
349
+			return;
350
+		}
351
+
352
+		/**
353
+		 * @param mixed $file
354
+		 *
355
+		 * @return void
356
+		 *
357
+		 * @throws InvalidArgumentException
358
+		 *
359
+		 * @psalm-suppress MissingClosureParamType
360
+		 */
361
+		array_walk_recursive($files, static function ($file): void {
362
+			if (! ($file instanceof UploadedFileInterface)) {
363
+				throw new InvalidArgumentException('Invalid uploaded files');
364
+			}
365
+		});
366
+	}
367
+
368
+	/**
369
+	 * Validates the given parsed body
370
+	 *
371
+	 * @param mixed $data
372
+	 *
373
+	 * @return void
374
+	 *
375
+	 * @throws InvalidArgumentException
376
+	 *         If the parsed body isn't valid.
377
+	 */
378
+	private function validateParsedBody($data): void
379
+	{
380
+		if (null === $data) {
381
+			return;
382
+		}
383
+
384
+		if (!is_array($data) && !is_object($data)) {
385
+			throw new InvalidArgumentException('Invalid parsed body');
386
+		}
387
+	}
388 388
 }
Please login to merge, or discard this patch.
src/UploadedFileFactory.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -31,22 +31,22 @@
 block discarded – undo
31 31
 class UploadedFileFactory implements UploadedFileFactoryInterface
32 32
 {
33 33
 
34
-    /**
35
-     * {@inheritdoc}
36
-     */
37
-    public function createUploadedFile(
38
-        StreamInterface $stream,
39
-        ?int $size = null,
40
-        int $error = UPLOAD_ERR_OK,
41
-        ?string $clientFilename = null,
42
-        ?string $clientMediaType = null
43
-    ): UploadedFileInterface {
44
-        return new UploadedFile(
45
-            $stream,
46
-            $size,
47
-            $error,
48
-            $clientFilename,
49
-            $clientMediaType
50
-        );
51
-    }
34
+	/**
35
+	 * {@inheritdoc}
36
+	 */
37
+	public function createUploadedFile(
38
+		StreamInterface $stream,
39
+		?int $size = null,
40
+		int $error = UPLOAD_ERR_OK,
41
+		?string $clientFilename = null,
42
+		?string $clientMediaType = null
43
+	): UploadedFileInterface {
44
+		return new UploadedFile(
45
+			$stream,
46
+			$size,
47
+			$error,
48
+			$clientFilename,
49
+			$clientMediaType
50
+		);
51
+	}
52 52
 }
Please login to merge, or discard this patch.
functions/server_request_headers.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -32,29 +32,29 @@
 block discarded – undo
32 32
  */
33 33
 function server_request_headers(?array $serverParams = null): array
34 34
 {
35
-    $serverParams ??= $_SERVER;
35
+	$serverParams ??= $_SERVER;
36 36
 
37
-    // https://datatracker.ietf.org/doc/html/rfc3875#section-4.1.2
38
-    if (!isset($serverParams['HTTP_CONTENT_LENGTH']) && isset($serverParams['CONTENT_LENGTH'])) {
39
-        $serverParams['HTTP_CONTENT_LENGTH'] = $serverParams['CONTENT_LENGTH'];
40
-    }
37
+	// https://datatracker.ietf.org/doc/html/rfc3875#section-4.1.2
38
+	if (!isset($serverParams['HTTP_CONTENT_LENGTH']) && isset($serverParams['CONTENT_LENGTH'])) {
39
+		$serverParams['HTTP_CONTENT_LENGTH'] = $serverParams['CONTENT_LENGTH'];
40
+	}
41 41
 
42
-    // https://datatracker.ietf.org/doc/html/rfc3875#section-4.1.3
43
-    if (!isset($serverParams['HTTP_CONTENT_TYPE']) && isset($serverParams['CONTENT_TYPE'])) {
44
-        $serverParams['HTTP_CONTENT_TYPE'] = $serverParams['CONTENT_TYPE'];
45
-    }
42
+	// https://datatracker.ietf.org/doc/html/rfc3875#section-4.1.3
43
+	if (!isset($serverParams['HTTP_CONTENT_TYPE']) && isset($serverParams['CONTENT_TYPE'])) {
44
+		$serverParams['HTTP_CONTENT_TYPE'] = $serverParams['CONTENT_TYPE'];
45
+	}
46 46
 
47
-    $result = [];
48
-    foreach ($serverParams as $key => $value) {
49
-        if (0 <> strncmp('HTTP_', $key, 5)) {
50
-            continue;
51
-        }
47
+	$result = [];
48
+	foreach ($serverParams as $key => $value) {
49
+		if (0 <> strncmp('HTTP_', $key, 5)) {
50
+			continue;
51
+		}
52 52
 
53
-        $name = strtr(substr($key, 5), '_', '-');
54
-        $name = ucwords(strtolower($name), '-');
53
+		$name = strtr(substr($key, 5), '_', '-');
54
+		$name = ucwords(strtolower($name), '-');
55 55
 
56
-        $result[$name] = $value;
57
-    }
56
+		$result[$name] = $value;
57
+	}
58 58
 
59
-    return $result;
59
+	return $result;
60 60
 }
Please login to merge, or discard this patch.
functions/server_request_method.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
  */
24 24
 function server_request_method(?array $serverParams = null): string
25 25
 {
26
-    $serverParams ??= $_SERVER;
26
+	$serverParams ??= $_SERVER;
27 27
 
28
-    return $serverParams['REQUEST_METHOD'] ?? Request::METHOD_GET;
28
+	return $serverParams['REQUEST_METHOD'] ?? Request::METHOD_GET;
29 29
 }
Please login to merge, or discard this patch.
functions/server_request_protocol_version.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -29,24 +29,24 @@
 block discarded – undo
29 29
  */
30 30
 function server_request_protocol_version(?array $serverParams = null): string
31 31
 {
32
-    $serverParams ??= $_SERVER;
32
+	$serverParams ??= $_SERVER;
33 33
 
34
-    if (!isset($serverParams['SERVER_PROTOCOL'])) {
35
-        return '1.1';
36
-    }
34
+	if (!isset($serverParams['SERVER_PROTOCOL'])) {
35
+		return '1.1';
36
+	}
37 37
 
38
-    // "HTTP" "/" 1*digit "." 1*digit
39
-    sscanf($serverParams['SERVER_PROTOCOL'], 'HTTP/%d.%d', $major, $minor);
38
+	// "HTTP" "/" 1*digit "." 1*digit
39
+	sscanf($serverParams['SERVER_PROTOCOL'], 'HTTP/%d.%d', $major, $minor);
40 40
 
41
-    // e.g.: HTTP/1.1
42
-    if (isset($minor)) {
43
-        return sprintf('%d.%d', $major, $minor);
44
-    }
41
+	// e.g.: HTTP/1.1
42
+	if (isset($minor)) {
43
+		return sprintf('%d.%d', $major, $minor);
44
+	}
45 45
 
46
-    // e.g.: HTTP/2
47
-    if (isset($major)) {
48
-        return sprintf('%d', $major);
49
-    }
46
+	// e.g.: HTTP/2
47
+	if (isset($major)) {
48
+		return sprintf('%d', $major);
49
+	}
50 50
 
51
-    return '1.1';
51
+	return '1.1';
52 52
 }
Please login to merge, or discard this patch.