Passed
Pull Request — master (#34)
by Anatoly
04:38
created
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.
src/Uri/Component/Host.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -23,46 +23,46 @@
 block discarded – undo
23 23
  */
24 24
 final class Host implements ComponentInterface
25 25
 {
26
-    // phpcs:ignore Generic.Files.LineLength
27
-    private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x2e\x30-\x39\x3b\x3d\x41-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u';
26
+	// phpcs:ignore Generic.Files.LineLength
27
+	private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x2e\x30-\x39\x3b\x3d\x41-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u';
28 28
 
29
-    private string $value = '';
29
+	private string $value = '';
30 30
 
31
-    /**
32
-     * @param mixed $value
33
-     *
34
-     * @throws InvalidArgumentException
35
-     */
36
-    public function __construct($value)
37
-    {
38
-        if ($value === '') {
39
-            return;
40
-        }
31
+	/**
32
+	 * @param mixed $value
33
+	 *
34
+	 * @throws InvalidArgumentException
35
+	 */
36
+	public function __construct($value)
37
+	{
38
+		if ($value === '') {
39
+			return;
40
+		}
41 41
 
42
-        if (!is_string($value)) {
43
-            throw new InvalidArgumentException('URI component "host" must be a string');
44
-        }
42
+		if (!is_string($value)) {
43
+			throw new InvalidArgumentException('URI component "host" must be a string');
44
+		}
45 45
 
46
-        $this->value = (string) preg_replace_callback(
47
-            self::NORMALIZATION_REGEX,
48
-            static fn(array $matches): string => (
49
-                /** @var array{0: string, 1?: string} $matches */
50
-                isset($matches[1]) ? rawurlencode($matches[1]) : $matches[0]
51
-            ),
52
-            $value,
53
-        );
46
+		$this->value = (string) preg_replace_callback(
47
+			self::NORMALIZATION_REGEX,
48
+			static fn(array $matches): string => (
49
+				/** @var array{0: string, 1?: string} $matches */
50
+				isset($matches[1]) ? rawurlencode($matches[1]) : $matches[0]
51
+			),
52
+			$value,
53
+		);
54 54
 
55
-        // the component is case-insensitive...
56
-        $this->value = strtolower($this->value);
57
-    }
55
+		// the component is case-insensitive...
56
+		$this->value = strtolower($this->value);
57
+	}
58 58
 
59
-    /**
60
-     * {@inheritdoc}
61
-     *
62
-     * @return string
63
-     */
64
-    public function getValue(): string
65
-    {
66
-        return $this->value;
67
-    }
59
+	/**
60
+	 * {@inheritdoc}
61
+	 *
62
+	 * @return string
63
+	 */
64
+	public function getValue(): string
65
+	{
66
+		return $this->value;
67
+	}
68 68
 }
Please login to merge, or discard this patch.
src/Uri/Component/Scheme.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -22,40 +22,40 @@
 block discarded – undo
22 22
  */
23 23
 final class Scheme implements ComponentInterface
24 24
 {
25
-    private const VALIDATION_REGEX = '/^(?:[A-Za-z][0-9A-Za-z\x2b\x2d\x2e]*)?$/';
26
-
27
-    private string $value = '';
28
-
29
-    /**
30
-     * @param mixed $value
31
-     *
32
-     * @throws InvalidArgumentException
33
-     */
34
-    public function __construct($value)
35
-    {
36
-        if ($value === '') {
37
-            return;
38
-        }
39
-
40
-        if (!is_string($value)) {
41
-            throw new InvalidArgumentException('URI component "scheme" must be a string');
42
-        }
43
-
44
-        if (!preg_match(self::VALIDATION_REGEX, $value)) {
45
-            throw new InvalidArgumentException('Invalid URI component "scheme"');
46
-        }
47
-
48
-        // the component is case-insensitive...
49
-        $this->value = strtolower($value);
50
-    }
51
-
52
-    /**
53
-     * {@inheritdoc}
54
-     *
55
-     * @return string
56
-     */
57
-    public function getValue(): string
58
-    {
59
-        return $this->value;
60
-    }
25
+	private const VALIDATION_REGEX = '/^(?:[A-Za-z][0-9A-Za-z\x2b\x2d\x2e]*)?$/';
26
+
27
+	private string $value = '';
28
+
29
+	/**
30
+	 * @param mixed $value
31
+	 *
32
+	 * @throws InvalidArgumentException
33
+	 */
34
+	public function __construct($value)
35
+	{
36
+		if ($value === '') {
37
+			return;
38
+		}
39
+
40
+		if (!is_string($value)) {
41
+			throw new InvalidArgumentException('URI component "scheme" must be a string');
42
+		}
43
+
44
+		if (!preg_match(self::VALIDATION_REGEX, $value)) {
45
+			throw new InvalidArgumentException('Invalid URI component "scheme"');
46
+		}
47
+
48
+		// the component is case-insensitive...
49
+		$this->value = strtolower($value);
50
+	}
51
+
52
+	/**
53
+	 * {@inheritdoc}
54
+	 *
55
+	 * @return string
56
+	 */
57
+	public function getValue(): string
58
+	{
59
+		return $this->value;
60
+	}
61 61
 }
Please login to merge, or discard this patch.
src/HeaderInterface.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@
 block discarded – undo
18 18
  */
19 19
 interface HeaderInterface extends IteratorAggregate
20 20
 {
21
-    public const RFC822_DATE_FORMAT = 'D, d M y H:i:s O';
21
+	public const RFC822_DATE_FORMAT = 'D, d M y H:i:s O';
22 22
 
23
-    public const RFC7230_TOKEN_REGEX = '/^[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7A\x7C\x7E]+$/';
23
+	public const RFC7230_TOKEN_REGEX = '/^[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7A\x7C\x7E]+$/';
24 24
 
25
-    public const RFC7230_FIELD_VALUE_REGEX = '/^[\x09\x20-\x7E\x80-\xFF]*$/';
25
+	public const RFC7230_FIELD_VALUE_REGEX = '/^[\x09\x20-\x7E\x80-\xFF]*$/';
26 26
 
27
-    public const RFC7230_QUOTED_STRING_REGEX = '/^(?:[\x5C][\x22]|[\x09\x20\x21\x23-\x5B\x5D-\x7E\x80-\xFF])*$/';
27
+	public const RFC7230_QUOTED_STRING_REGEX = '/^(?:[\x5C][\x22]|[\x09\x20\x21\x23-\x5B\x5D-\x7E\x80-\xFF])*$/';
28 28
 
29
-    public function getFieldName(): string;
29
+	public function getFieldName(): string;
30 30
 
31
-    public function getFieldValue(): string;
31
+	public function getFieldValue(): string;
32 32
 
33
-    public function __toString(): string;
33
+	public function __toString(): string;
34 34
 }
Please login to merge, or discard this patch.