Passed
Push — master ( c3277e...6db6a3 )
by Anatoly
04:11 queued 16s
created
src/Stream/TmpfileStream.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -26,31 +26,31 @@
 block discarded – undo
26 26
  */
27 27
 final class TmpfileStream extends Stream
28 28
 {
29
-    /**
30
-     * @throws RuntimeException
31
-     */
32
-    public function __construct()
33
-    {
34
-        parent::__construct(self::createFile());
35
-    }
36
-
37
-    /**
38
-     * @return resource
39
-     *
40
-     * @throws RuntimeException
41
-     */
42
-    private static function createFile()
43
-    {
44
-        $dirname = sys_get_temp_dir();
45
-        if (!is_writable($dirname)) {
46
-            throw new RuntimeException('Temporary files directory is not writable');
47
-        }
48
-
49
-        $resource = tmpfile();
50
-        if (!is_resource($resource)) {
51
-            throw new RuntimeException('Temporary file cannot be created or opened');
52
-        }
53
-
54
-        return $resource;
55
-    }
29
+	/**
30
+	 * @throws RuntimeException
31
+	 */
32
+	public function __construct()
33
+	{
34
+		parent::__construct(self::createFile());
35
+	}
36
+
37
+	/**
38
+	 * @return resource
39
+	 *
40
+	 * @throws RuntimeException
41
+	 */
42
+	private static function createFile()
43
+	{
44
+		$dirname = sys_get_temp_dir();
45
+		if (!is_writable($dirname)) {
46
+			throw new RuntimeException('Temporary files directory is not writable');
47
+		}
48
+
49
+		$resource = tmpfile();
50
+		if (!is_resource($resource)) {
51
+			throw new RuntimeException('Temporary file cannot be created or opened');
52
+		}
53
+
54
+		return $resource;
55
+	}
56 56
 }
Please login to merge, or discard this patch.
src/Uri/Component/Port.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -20,40 +20,40 @@
 block discarded – undo
20 20
  */
21 21
 final class Port implements ComponentInterface
22 22
 {
23
-    private const MIN_VALUE = 1;
24
-    private const MAX_VALUE = (2 ** 16) - 1;
25
-
26
-    private ?int $value = null;
27
-
28
-    /**
29
-     * @param mixed $value
30
-     *
31
-     * @throws InvalidArgumentException
32
-     */
33
-    public function __construct($value)
34
-    {
35
-        if ($value === null) {
36
-            return;
37
-        }
38
-
39
-        if (!is_int($value)) {
40
-            throw new InvalidArgumentException('URI component "port" must be an integer');
41
-        }
42
-
43
-        if (!($value >= self::MIN_VALUE && $value <= self::MAX_VALUE)) {
44
-            throw new InvalidArgumentException('Invalid URI component "port"');
45
-        }
46
-
47
-        $this->value = $value;
48
-    }
49
-
50
-    /**
51
-     * {@inheritdoc}
52
-     *
53
-     * @return int|null
54
-     */
55
-    public function getValue(): ?int
56
-    {
57
-        return $this->value;
58
-    }
23
+	private const MIN_VALUE = 1;
24
+	private const MAX_VALUE = (2 ** 16) - 1;
25
+
26
+	private ?int $value = null;
27
+
28
+	/**
29
+	 * @param mixed $value
30
+	 *
31
+	 * @throws InvalidArgumentException
32
+	 */
33
+	public function __construct($value)
34
+	{
35
+		if ($value === null) {
36
+			return;
37
+		}
38
+
39
+		if (!is_int($value)) {
40
+			throw new InvalidArgumentException('URI component "port" must be an integer');
41
+		}
42
+
43
+		if (!($value >= self::MIN_VALUE && $value <= self::MAX_VALUE)) {
44
+			throw new InvalidArgumentException('Invalid URI component "port"');
45
+		}
46
+
47
+		$this->value = $value;
48
+	}
49
+
50
+	/**
51
+	 * {@inheritdoc}
52
+	 *
53
+	 * @return int|null
54
+	 */
55
+	public function getValue(): ?int
56
+	{
57
+		return $this->value;
58
+	}
59 59
 }
Please login to merge, or discard this patch.
src/Uri/Component/Query.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -22,43 +22,43 @@
 block discarded – undo
22 22
  */
23 23
 final class Query implements ComponentInterface
24 24
 {
25
-    // phpcs:ignore Generic.Files.LineLength
26
-    private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x3b\x3d\x3f-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u';
25
+	// phpcs:ignore Generic.Files.LineLength
26
+	private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x3b\x3d\x3f-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u';
27 27
 
28
-    private string $value = '';
28
+	private string $value = '';
29 29
 
30
-    /**
31
-     * @param mixed $value
32
-     *
33
-     * @throws InvalidArgumentException
34
-     */
35
-    public function __construct($value)
36
-    {
37
-        if ($value === '') {
38
-            return;
39
-        }
30
+	/**
31
+	 * @param mixed $value
32
+	 *
33
+	 * @throws InvalidArgumentException
34
+	 */
35
+	public function __construct($value)
36
+	{
37
+		if ($value === '') {
38
+			return;
39
+		}
40 40
 
41
-        if (!is_string($value)) {
42
-            throw new InvalidArgumentException('URI component "query" must be a string');
43
-        }
41
+		if (!is_string($value)) {
42
+			throw new InvalidArgumentException('URI component "query" must be a string');
43
+		}
44 44
 
45
-        $this->value = (string) preg_replace_callback(
46
-            self::NORMALIZATION_REGEX,
47
-            static fn(array $matches): string => (
48
-                /** @var array{0: string, 1?: string} $matches */
49
-                isset($matches[1]) ? rawurlencode($matches[1]) : $matches[0]
50
-            ),
51
-            $value,
52
-        );
53
-    }
45
+		$this->value = (string) preg_replace_callback(
46
+			self::NORMALIZATION_REGEX,
47
+			static fn(array $matches): string => (
48
+				/** @var array{0: string, 1?: string} $matches */
49
+				isset($matches[1]) ? rawurlencode($matches[1]) : $matches[0]
50
+			),
51
+			$value,
52
+		);
53
+	}
54 54
 
55
-    /**
56
-     * {@inheritdoc}
57
-     *
58
-     * @return string
59
-     */
60
-    public function getValue(): string
61
-    {
62
-        return $this->value;
63
-    }
55
+	/**
56
+	 * {@inheritdoc}
57
+	 *
58
+	 * @return string
59
+	 */
60
+	public function getValue(): string
61
+	{
62
+		return $this->value;
63
+	}
64 64
 }
Please login to merge, or discard this patch.
src/Uri/Component/Fragment.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -22,43 +22,43 @@
 block discarded – undo
22 22
  */
23 23
 final class Fragment implements ComponentInterface
24 24
 {
25
-    // phpcs:ignore Generic.Files.LineLength
26
-    private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x3b\x3d\x3f-\x5a\x5f\x61-\x7a\x7e])*|(.?)/u';
25
+	// phpcs:ignore Generic.Files.LineLength
26
+	private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x3b\x3d\x3f-\x5a\x5f\x61-\x7a\x7e])*|(.?)/u';
27 27
 
28
-    private string $value = '';
28
+	private string $value = '';
29 29
 
30
-    /**
31
-     * @param mixed $value
32
-     *
33
-     * @throws InvalidArgumentException
34
-     */
35
-    public function __construct($value)
36
-    {
37
-        if ($value === '') {
38
-            return;
39
-        }
30
+	/**
31
+	 * @param mixed $value
32
+	 *
33
+	 * @throws InvalidArgumentException
34
+	 */
35
+	public function __construct($value)
36
+	{
37
+		if ($value === '') {
38
+			return;
39
+		}
40 40
 
41
-        if (!is_string($value)) {
42
-            throw new InvalidArgumentException('URI component "fragment" must be a string');
43
-        }
41
+		if (!is_string($value)) {
42
+			throw new InvalidArgumentException('URI component "fragment" must be a string');
43
+		}
44 44
 
45
-        $this->value = (string) preg_replace_callback(
46
-            self::NORMALIZATION_REGEX,
47
-            static fn(array $matches): string => (
48
-                /** @var array{0: string, 1?: string} $matches */
49
-                isset($matches[1]) ? rawurlencode($matches[1]) : $matches[0]
50
-            ),
51
-            $value,
52
-        );
53
-    }
45
+		$this->value = (string) preg_replace_callback(
46
+			self::NORMALIZATION_REGEX,
47
+			static fn(array $matches): string => (
48
+				/** @var array{0: string, 1?: string} $matches */
49
+				isset($matches[1]) ? rawurlencode($matches[1]) : $matches[0]
50
+			),
51
+			$value,
52
+		);
53
+	}
54 54
 
55
-    /**
56
-     * {@inheritdoc}
57
-     *
58
-     * @return string
59
-     */
60
-    public function getValue(): string
61
-    {
62
-        return $this->value;
63
-    }
55
+	/**
56
+	 * {@inheritdoc}
57
+	 *
58
+	 * @return string
59
+	 */
60
+	public function getValue(): string
61
+	{
62
+		return $this->value;
63
+	}
64 64
 }
Please login to merge, or discard this patch.
src/Uri/Component/UserInfo.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -18,37 +18,37 @@
 block discarded – undo
18 18
  */
19 19
 final class UserInfo implements ComponentInterface
20 20
 {
21
-    private User $user;
22
-    private ?Password $password = null;
23
-
24
-    /**
25
-     * @param mixed $user
26
-     * @param mixed $password
27
-     *
28
-     * @throws InvalidArgumentException
29
-     */
30
-    public function __construct($user, $password = null)
31
-    {
32
-        $this->user = User::create($user);
33
-
34
-        if ($password !== null) {
35
-            $this->password = Password::create($password);
36
-        }
37
-    }
38
-
39
-    /**
40
-     * {@inheritdoc}
41
-     *
42
-     * @return string
43
-     */
44
-    public function getValue(): string
45
-    {
46
-        $value = $this->user->getValue();
47
-
48
-        if ($this->password !== null) {
49
-            $value .= ':' . $this->password->getValue();
50
-        }
51
-
52
-        return $value;
53
-    }
21
+	private User $user;
22
+	private ?Password $password = null;
23
+
24
+	/**
25
+	 * @param mixed $user
26
+	 * @param mixed $password
27
+	 *
28
+	 * @throws InvalidArgumentException
29
+	 */
30
+	public function __construct($user, $password = null)
31
+	{
32
+		$this->user = User::create($user);
33
+
34
+		if ($password !== null) {
35
+			$this->password = Password::create($password);
36
+		}
37
+	}
38
+
39
+	/**
40
+	 * {@inheritdoc}
41
+	 *
42
+	 * @return string
43
+	 */
44
+	public function getValue(): string
45
+	{
46
+		$value = $this->user->getValue();
47
+
48
+		if ($this->password !== null) {
49
+			$value .= ':' . $this->password->getValue();
50
+		}
51
+
52
+		return $value;
53
+	}
54 54
 }
Please login to merge, or discard this patch.
src/Uri/Component/User.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -22,57 +22,57 @@
 block discarded – undo
22 22
  */
23 23
 final class User implements ComponentInterface
24 24
 {
25
-    // phpcs:ignore Generic.Files.LineLength
26
-    private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x2e\x30-\x39\x3b\x3d\x41-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u';
25
+	// phpcs:ignore Generic.Files.LineLength
26
+	private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x2e\x30-\x39\x3b\x3d\x41-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u';
27 27
 
28
-    private string $value = '';
28
+	private string $value = '';
29 29
 
30
-    /**
31
-     * @param mixed $value
32
-     *
33
-     * @throws InvalidArgumentException
34
-     */
35
-    public function __construct($value)
36
-    {
37
-        if ($value === '') {
38
-            return;
39
-        }
30
+	/**
31
+	 * @param mixed $value
32
+	 *
33
+	 * @throws InvalidArgumentException
34
+	 */
35
+	public function __construct($value)
36
+	{
37
+		if ($value === '') {
38
+			return;
39
+		}
40 40
 
41
-        if (!is_string($value)) {
42
-            throw new InvalidArgumentException('URI component "user" must be a string');
43
-        }
41
+		if (!is_string($value)) {
42
+			throw new InvalidArgumentException('URI component "user" must be a string');
43
+		}
44 44
 
45
-        $this->value = (string) preg_replace_callback(
46
-            self::NORMALIZATION_REGEX,
47
-            static fn(array $matches): string => (
48
-                /** @var array{0: string, 1?: string} $matches */
49
-                isset($matches[1]) ? rawurlencode($matches[1]) : $matches[0]
50
-            ),
51
-            $value,
52
-        );
53
-    }
45
+		$this->value = (string) preg_replace_callback(
46
+			self::NORMALIZATION_REGEX,
47
+			static fn(array $matches): string => (
48
+				/** @var array{0: string, 1?: string} $matches */
49
+				isset($matches[1]) ? rawurlencode($matches[1]) : $matches[0]
50
+			),
51
+			$value,
52
+		);
53
+	}
54 54
 
55
-    /**
56
-     * @param mixed $user
57
-     *
58
-     * @throws InvalidArgumentException
59
-     */
60
-    public static function create($user): User
61
-    {
62
-        if ($user instanceof User) {
63
-            return $user;
64
-        }
55
+	/**
56
+	 * @param mixed $user
57
+	 *
58
+	 * @throws InvalidArgumentException
59
+	 */
60
+	public static function create($user): User
61
+	{
62
+		if ($user instanceof User) {
63
+			return $user;
64
+		}
65 65
 
66
-        return new User($user);
67
-    }
66
+		return new User($user);
67
+	}
68 68
 
69
-    /**
70
-     * {@inheritdoc}
71
-     *
72
-     * @return string
73
-     */
74
-    public function getValue(): string
75
-    {
76
-        return $this->value;
77
-    }
69
+	/**
70
+	 * {@inheritdoc}
71
+	 *
72
+	 * @return string
73
+	 */
74
+	public function getValue(): string
75
+	{
76
+		return $this->value;
77
+	}
78 78
 }
Please login to merge, or discard this patch.
src/Uri/Component/Password.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -22,57 +22,57 @@
 block discarded – undo
22 22
  */
23 23
 final class Password implements ComponentInterface
24 24
 {
25
-    // phpcs:ignore Generic.Files.LineLength
26
-    private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x2e\x30-\x39\x3b\x3d\x41-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u';
25
+	// phpcs:ignore Generic.Files.LineLength
26
+	private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x2e\x30-\x39\x3b\x3d\x41-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u';
27 27
 
28
-    private string $value = '';
28
+	private string $value = '';
29 29
 
30
-    /**
31
-     * @param mixed $value
32
-     *
33
-     * @throws InvalidArgumentException
34
-     */
35
-    public function __construct($value)
36
-    {
37
-        if ($value === '') {
38
-            return;
39
-        }
30
+	/**
31
+	 * @param mixed $value
32
+	 *
33
+	 * @throws InvalidArgumentException
34
+	 */
35
+	public function __construct($value)
36
+	{
37
+		if ($value === '') {
38
+			return;
39
+		}
40 40
 
41
-        if (!is_string($value)) {
42
-            throw new InvalidArgumentException('URI component "password" must be a string');
43
-        }
41
+		if (!is_string($value)) {
42
+			throw new InvalidArgumentException('URI component "password" must be a string');
43
+		}
44 44
 
45
-        $this->value = (string) preg_replace_callback(
46
-            self::NORMALIZATION_REGEX,
47
-            static fn(array $matches): string => (
48
-                /** @var array{0: string, 1?: string} $matches */
49
-                isset($matches[1]) ? rawurlencode($matches[1]) : $matches[0]
50
-            ),
51
-            $value,
52
-        );
53
-    }
45
+		$this->value = (string) preg_replace_callback(
46
+			self::NORMALIZATION_REGEX,
47
+			static fn(array $matches): string => (
48
+				/** @var array{0: string, 1?: string} $matches */
49
+				isset($matches[1]) ? rawurlencode($matches[1]) : $matches[0]
50
+			),
51
+			$value,
52
+		);
53
+	}
54 54
 
55
-    /**
56
-     * @param mixed $password
57
-     *
58
-     * @throws InvalidArgumentException
59
-     */
60
-    public static function create($password): Password
61
-    {
62
-        if ($password instanceof Password) {
63
-            return $password;
64
-        }
55
+	/**
56
+	 * @param mixed $password
57
+	 *
58
+	 * @throws InvalidArgumentException
59
+	 */
60
+	public static function create($password): Password
61
+	{
62
+		if ($password instanceof Password) {
63
+			return $password;
64
+		}
65 65
 
66
-        return new Password($password);
67
-    }
66
+		return new Password($password);
67
+	}
68 68
 
69
-    /**
70
-     * {@inheritdoc}
71
-     *
72
-     * @return string
73
-     */
74
-    public function getValue(): string
75
-    {
76
-        return $this->value;
77
-    }
69
+	/**
70
+	 * {@inheritdoc}
71
+	 *
72
+	 * @return string
73
+	 */
74
+	public function getValue(): string
75
+	{
76
+		return $this->value;
77
+	}
78 78
 }
Please login to merge, or discard this patch.
src/Uri/Component/Path.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -22,43 +22,43 @@
 block discarded – undo
22 22
  */
23 23
 final class Path implements ComponentInterface
24 24
 {
25
-    // phpcs:ignore Generic.Files.LineLength
26
-    private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x3b\x3d\x40-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u';
25
+	// phpcs:ignore Generic.Files.LineLength
26
+	private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x3b\x3d\x40-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u';
27 27
 
28
-    private string $value = '';
28
+	private string $value = '';
29 29
 
30
-    /**
31
-     * @param mixed $value
32
-     *
33
-     * @throws InvalidArgumentException
34
-     */
35
-    public function __construct($value)
36
-    {
37
-        if ($value === '') {
38
-            return;
39
-        }
30
+	/**
31
+	 * @param mixed $value
32
+	 *
33
+	 * @throws InvalidArgumentException
34
+	 */
35
+	public function __construct($value)
36
+	{
37
+		if ($value === '') {
38
+			return;
39
+		}
40 40
 
41
-        if (!is_string($value)) {
42
-            throw new InvalidArgumentException('URI component "path" must be a string');
43
-        }
41
+		if (!is_string($value)) {
42
+			throw new InvalidArgumentException('URI component "path" must be a string');
43
+		}
44 44
 
45
-        $this->value = (string) preg_replace_callback(
46
-            self::NORMALIZATION_REGEX,
47
-            static fn(array $matches): string => (
48
-                /** @var array{0: string, 1?: string} $matches */
49
-                isset($matches[1]) ? rawurlencode($matches[1]) : $matches[0]
50
-            ),
51
-            $value,
52
-        );
53
-    }
45
+		$this->value = (string) preg_replace_callback(
46
+			self::NORMALIZATION_REGEX,
47
+			static fn(array $matches): string => (
48
+				/** @var array{0: string, 1?: string} $matches */
49
+				isset($matches[1]) ? rawurlencode($matches[1]) : $matches[0]
50
+			),
51
+			$value,
52
+		);
53
+	}
54 54
 
55
-    /**
56
-     * {@inheritdoc}
57
-     *
58
-     * @return string
59
-     */
60
-    public function getValue(): string
61
-    {
62
-        return $this->value;
63
-    }
55
+	/**
56
+	 * {@inheritdoc}
57
+	 *
58
+	 * @return string
59
+	 */
60
+	public function getValue(): string
61
+	{
62
+		return $this->value;
63
+	}
64 64
 }
Please login to merge, or discard this patch.
src/Uri/Component/ComponentInterface.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
 
14 14
 interface ComponentInterface
15 15
 {
16
-    /**
17
-     * @return mixed
18
-     */
19
-    public function getValue();
16
+	/**
17
+	 * @return mixed
18
+	 */
19
+	public function getValue();
20 20
 }
Please login to merge, or discard this patch.