Passed
Push — master ( c01d71...667403 )
by Anatoly
04:35
created
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.
functions/server_request_method.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
  */
17 17
 function server_request_method(?array $serverParams = null): string
18 18
 {
19
-    $serverParams ??= $_SERVER;
19
+	$serverParams ??= $_SERVER;
20 20
 
21
-    return $serverParams['REQUEST_METHOD'] ?? 'GET';
21
+	return $serverParams['REQUEST_METHOD'] ?? 'GET';
22 22
 }
Please login to merge, or discard this patch.
functions/server_request_files.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -26,43 +26,43 @@
 block discarded – undo
26 26
  */
27 27
 function server_request_files(?array $files = null): array
28 28
 {
29
-    $files ??= $_FILES;
29
+	$files ??= $_FILES;
30 30
 
31
-    $walker = static function ($path, $size, $error, $name, $type) use (&$walker) {
32
-        if (!is_array($path)) {
33
-            $stream = $error === UPLOAD_ERR_OK ? new FileStream($path, 'rb') : null;
31
+	$walker = static function ($path, $size, $error, $name, $type) use (&$walker) {
32
+		if (!is_array($path)) {
33
+			$stream = $error === UPLOAD_ERR_OK ? new FileStream($path, 'rb') : null;
34 34
 
35
-            return new UploadedFile($stream, $size, $error, $name, $type);
36
-        }
35
+			return new UploadedFile($stream, $size, $error, $name, $type);
36
+		}
37 37
 
38
-        $result = [];
39
-        foreach ($path as $key => $_) {
40
-            if ($error[$key] !== UPLOAD_ERR_NO_FILE) {
41
-                $result[$key] = $walker(
42
-                    $path[$key],
43
-                    $size[$key],
44
-                    $error[$key],
45
-                    $name[$key],
46
-                    $type[$key],
47
-                );
48
-            }
49
-        }
38
+		$result = [];
39
+		foreach ($path as $key => $_) {
40
+			if ($error[$key] !== UPLOAD_ERR_NO_FILE) {
41
+				$result[$key] = $walker(
42
+					$path[$key],
43
+					$size[$key],
44
+					$error[$key],
45
+					$name[$key],
46
+					$type[$key],
47
+				);
48
+			}
49
+		}
50 50
 
51
-        return $result;
52
-    };
51
+		return $result;
52
+	};
53 53
 
54
-    $result = [];
55
-    foreach ($files as $key => $file) {
56
-        if ($file['error'] !== UPLOAD_ERR_NO_FILE) {
57
-            $result[$key] = $walker(
58
-                $file['tmp_name'],
59
-                $file['size'],
60
-                $file['error'],
61
-                $file['name'],
62
-                $file['type'],
63
-            );
64
-        }
65
-    }
54
+	$result = [];
55
+	foreach ($files as $key => $file) {
56
+		if ($file['error'] !== UPLOAD_ERR_NO_FILE) {
57
+			$result[$key] = $walker(
58
+				$file['tmp_name'],
59
+				$file['size'],
60
+				$file['error'],
61
+				$file['name'],
62
+				$file['type'],
63
+			);
64
+		}
65
+	}
66 66
 
67
-    return $result;
67
+	return $result;
68 68
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 {
29 29
     $files ??= $_FILES;
30 30
 
31
-    $walker = static function ($path, $size, $error, $name, $type) use (&$walker) {
31
+    $walker = static function($path, $size, $error, $name, $type) use (&$walker) {
32 32
         if (!is_array($path)) {
33 33
             $stream = $error === UPLOAD_ERR_OK ? new FileStream($path, 'rb') : null;
34 34
 
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
@@ -25,29 +25,29 @@
 block discarded – undo
25 25
  */
26 26
 function server_request_headers(?array $serverParams = null): array
27 27
 {
28
-    $serverParams ??= $_SERVER;
28
+	$serverParams ??= $_SERVER;
29 29
 
30
-    // https://datatracker.ietf.org/doc/html/rfc3875#section-4.1.2
31
-    if (!isset($serverParams['HTTP_CONTENT_LENGTH']) && isset($serverParams['CONTENT_LENGTH'])) {
32
-        $serverParams['HTTP_CONTENT_LENGTH'] = $serverParams['CONTENT_LENGTH'];
33
-    }
30
+	// https://datatracker.ietf.org/doc/html/rfc3875#section-4.1.2
31
+	if (!isset($serverParams['HTTP_CONTENT_LENGTH']) && isset($serverParams['CONTENT_LENGTH'])) {
32
+		$serverParams['HTTP_CONTENT_LENGTH'] = $serverParams['CONTENT_LENGTH'];
33
+	}
34 34
 
35
-    // https://datatracker.ietf.org/doc/html/rfc3875#section-4.1.3
36
-    if (!isset($serverParams['HTTP_CONTENT_TYPE']) && isset($serverParams['CONTENT_TYPE'])) {
37
-        $serverParams['HTTP_CONTENT_TYPE'] = $serverParams['CONTENT_TYPE'];
38
-    }
35
+	// https://datatracker.ietf.org/doc/html/rfc3875#section-4.1.3
36
+	if (!isset($serverParams['HTTP_CONTENT_TYPE']) && isset($serverParams['CONTENT_TYPE'])) {
37
+		$serverParams['HTTP_CONTENT_TYPE'] = $serverParams['CONTENT_TYPE'];
38
+	}
39 39
 
40
-    $result = [];
41
-    foreach ($serverParams as $key => $value) {
42
-        if (strncmp('HTTP_', $key, 5) !== 0) {
43
-            continue;
44
-        }
40
+	$result = [];
41
+	foreach ($serverParams as $key => $value) {
42
+		if (strncmp('HTTP_', $key, 5) !== 0) {
43
+			continue;
44
+		}
45 45
 
46
-        $name = strtr(substr($key, 5), '_', '-');
47
-        $name = ucwords(strtolower($name), '-');
46
+		$name = strtr(substr($key, 5), '_', '-');
47
+		$name = ucwords(strtolower($name), '-');
48 48
 
49
-        $result[$name] = $value;
50
-    }
49
+		$result[$name] = $value;
50
+	}
51 51
 
52
-    return $result;
52
+	return $result;
53 53
 }
Please login to merge, or discard this patch.
functions/server_request_uri.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -17,35 +17,35 @@
 block discarded – undo
17 17
 
18 18
 function server_request_uri(?array $serverParams = null): UriInterface
19 19
 {
20
-    $serverParams ??= $_SERVER;
21
-
22
-    if (array_key_exists('HTTPS', $serverParams)) {
23
-        if ('off' !== $serverParams['HTTPS']) {
24
-            $scheme = 'https://';
25
-        }
26
-    }
27
-
28
-    if (array_key_exists('HTTP_HOST', $serverParams)) {
29
-        $host = $serverParams['HTTP_HOST'];
30
-    } elseif (array_key_exists('SERVER_NAME', $serverParams)) {
31
-        $host = $serverParams['SERVER_NAME'];
32
-        if (array_key_exists('SERVER_PORT', $serverParams)) {
33
-            $host .= ':' . $serverParams['SERVER_PORT'];
34
-        }
35
-    }
36
-
37
-    if (array_key_exists('REQUEST_URI', $serverParams)) {
38
-        $target = $serverParams['REQUEST_URI'];
39
-    } elseif (array_key_exists('PHP_SELF', $serverParams)) {
40
-        $target = $serverParams['PHP_SELF'];
41
-        if (array_key_exists('QUERY_STRING', $serverParams)) {
42
-            $target .= '?' . $serverParams['QUERY_STRING'];
43
-        }
44
-    }
45
-
46
-    return new Uri(
47
-        ($scheme ?? 'http://') .
48
-        ($host ?? 'localhost') .
49
-        ($target ?? '/')
50
-    );
20
+	$serverParams ??= $_SERVER;
21
+
22
+	if (array_key_exists('HTTPS', $serverParams)) {
23
+		if ('off' !== $serverParams['HTTPS']) {
24
+			$scheme = 'https://';
25
+		}
26
+	}
27
+
28
+	if (array_key_exists('HTTP_HOST', $serverParams)) {
29
+		$host = $serverParams['HTTP_HOST'];
30
+	} elseif (array_key_exists('SERVER_NAME', $serverParams)) {
31
+		$host = $serverParams['SERVER_NAME'];
32
+		if (array_key_exists('SERVER_PORT', $serverParams)) {
33
+			$host .= ':' . $serverParams['SERVER_PORT'];
34
+		}
35
+	}
36
+
37
+	if (array_key_exists('REQUEST_URI', $serverParams)) {
38
+		$target = $serverParams['REQUEST_URI'];
39
+	} elseif (array_key_exists('PHP_SELF', $serverParams)) {
40
+		$target = $serverParams['PHP_SELF'];
41
+		if (array_key_exists('QUERY_STRING', $serverParams)) {
42
+			$target .= '?' . $serverParams['QUERY_STRING'];
43
+		}
44
+	}
45
+
46
+	return new Uri(
47
+		($scheme ?? 'http://') .
48
+		($host ?? 'localhost') .
49
+		($target ?? '/')
50
+	);
51 51
 }
Please login to merge, or discard this patch.
src/Stream/PhpMemoryStream.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@
 block discarded – undo
17 17
 
18 18
 final class PhpMemoryStream extends Stream
19 19
 {
20
-    public function __construct(string $mode = 'r+b')
21
-    {
22
-        parent::__construct(fopen('php://memory', $mode));
23
-    }
20
+	public function __construct(string $mode = 'r+b')
21
+	{
22
+		parent::__construct(fopen('php://memory', $mode));
23
+	}
24 24
 }
Please login to merge, or discard this patch.
src/Stream/TempFileStream.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -22,36 +22,36 @@
 block discarded – undo
22 22
 
23 23
 final class TempFileStream extends Stream
24 24
 {
25
-    /**
26
-     * @throws RuntimeException
27
-     */
28
-    public function __construct(string $prefix = '')
29
-    {
30
-        parent::__construct(self::createFile($prefix));
31
-    }
32
-
33
-    /**
34
-     * @return resource
35
-     *
36
-     * @throws RuntimeException
37
-     */
38
-    private static function createFile(string $prefix)
39
-    {
40
-        $dirname = sys_get_temp_dir();
41
-        if (!is_writable($dirname)) {
42
-            throw new RuntimeException('Temporary files directory is not writable');
43
-        }
44
-
45
-        $filename = tempnam($dirname, $prefix);
46
-        if ($filename === false) {
47
-            throw new RuntimeException('Temporary file cannot be created');
48
-        }
49
-
50
-        $resource = fopen($filename, 'r+b');
51
-        if (!is_resource($resource)) {
52
-            throw new RuntimeException('Temporary file cannot be opened');
53
-        }
54
-
55
-        return $resource;
56
-    }
25
+	/**
26
+	 * @throws RuntimeException
27
+	 */
28
+	public function __construct(string $prefix = '')
29
+	{
30
+		parent::__construct(self::createFile($prefix));
31
+	}
32
+
33
+	/**
34
+	 * @return resource
35
+	 *
36
+	 * @throws RuntimeException
37
+	 */
38
+	private static function createFile(string $prefix)
39
+	{
40
+		$dirname = sys_get_temp_dir();
41
+		if (!is_writable($dirname)) {
42
+			throw new RuntimeException('Temporary files directory is not writable');
43
+		}
44
+
45
+		$filename = tempnam($dirname, $prefix);
46
+		if ($filename === false) {
47
+			throw new RuntimeException('Temporary file cannot be created');
48
+		}
49
+
50
+		$resource = fopen($filename, 'r+b');
51
+		if (!is_resource($resource)) {
52
+			throw new RuntimeException('Temporary file cannot be opened');
53
+		}
54
+
55
+		return $resource;
56
+	}
57 57
 }
Please login to merge, or discard this patch.
src/Stream/PhpTempStream.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@
 block discarded – undo
18 18
 
19 19
 final class PhpTempStream extends Stream
20 20
 {
21
-    /**
22
-     * @param int<0, max> $maxmemory
23
-     */
24
-    public function __construct(string $mode = 'r+b', int $maxmemory = 2097152)
25
-    {
26
-        $uri = sprintf('php://temp/maxmemory:%d', $maxmemory);
21
+	/**
22
+	 * @param int<0, max> $maxmemory
23
+	 */
24
+	public function __construct(string $mode = 'r+b', int $maxmemory = 2097152)
25
+	{
26
+		$uri = sprintf('php://temp/maxmemory:%d', $maxmemory);
27 27
 
28
-        parent::__construct(fopen($uri, $mode));
29
-    }
28
+		parent::__construct(fopen($uri, $mode));
29
+	}
30 30
 }
Please login to merge, or discard this patch.
src/Stream/PhpInputStream.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -21,24 +21,24 @@
 block discarded – undo
21 21
 
22 22
 final class PhpInputStream extends Stream
23 23
 {
24
-    public function __construct()
25
-    {
26
-        parent::__construct(self::copyInput());
27
-    }
28
-
29
-    /**
30
-     * @return resource
31
-     */
32
-    private static function copyInput()
33
-    {
34
-        /** @var resource $input */
35
-        $input = fopen('php://input', 'rb');
36
-        /** @var resource $resource */
37
-        $resource = fopen('php://temp', 'r+b');
38
-
39
-        stream_copy_to_stream($input, $resource);
40
-        fseek($resource, 0, SEEK_SET);
41
-
42
-        return $resource;
43
-    }
24
+	public function __construct()
25
+	{
26
+		parent::__construct(self::copyInput());
27
+	}
28
+
29
+	/**
30
+	 * @return resource
31
+	 */
32
+	private static function copyInput()
33
+	{
34
+		/** @var resource $input */
35
+		$input = fopen('php://input', 'rb');
36
+		/** @var resource $resource */
37
+		$resource = fopen('php://temp', 'r+b');
38
+
39
+		stream_copy_to_stream($input, $resource);
40
+		fseek($resource, 0, SEEK_SET);
41
+
42
+		return $resource;
43
+	}
44 44
 }
Please login to merge, or discard this patch.