@@ -19,48 +19,48 @@ |
||
19 | 19 | final class UserInfo implements ComponentInterface |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * URI component "user" |
|
24 | - * |
|
25 | - * @var User |
|
26 | - */ |
|
27 | - private User $user; |
|
22 | + /** |
|
23 | + * URI component "user" |
|
24 | + * |
|
25 | + * @var User |
|
26 | + */ |
|
27 | + private User $user; |
|
28 | 28 | |
29 | - /** |
|
30 | - * URI component "password" |
|
31 | - * |
|
32 | - * @var Password|null |
|
33 | - */ |
|
34 | - private ?Password $password = null; |
|
29 | + /** |
|
30 | + * URI component "password" |
|
31 | + * |
|
32 | + * @var Password|null |
|
33 | + */ |
|
34 | + private ?Password $password = null; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Constructor of the class |
|
38 | - * |
|
39 | - * @param mixed $user |
|
40 | - * @param mixed $password |
|
41 | - */ |
|
42 | - public function __construct($user, $password = null) |
|
43 | - { |
|
44 | - $this->user = User::create($user); |
|
36 | + /** |
|
37 | + * Constructor of the class |
|
38 | + * |
|
39 | + * @param mixed $user |
|
40 | + * @param mixed $password |
|
41 | + */ |
|
42 | + public function __construct($user, $password = null) |
|
43 | + { |
|
44 | + $this->user = User::create($user); |
|
45 | 45 | |
46 | - if (isset($password)) { |
|
47 | - $this->password = Password::create($password); |
|
48 | - } |
|
49 | - } |
|
46 | + if (isset($password)) { |
|
47 | + $this->password = Password::create($password); |
|
48 | + } |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * {@inheritdoc} |
|
53 | - * |
|
54 | - * @return string |
|
55 | - */ |
|
56 | - public function getValue(): string |
|
57 | - { |
|
58 | - $value = $this->user->getValue(); |
|
51 | + /** |
|
52 | + * {@inheritdoc} |
|
53 | + * |
|
54 | + * @return string |
|
55 | + */ |
|
56 | + public function getValue(): string |
|
57 | + { |
|
58 | + $value = $this->user->getValue(); |
|
59 | 59 | |
60 | - if (isset($this->password)) { |
|
61 | - $value .= ':' . $this->password->getValue(); |
|
62 | - } |
|
60 | + if (isset($this->password)) { |
|
61 | + $value .= ':' . $this->password->getValue(); |
|
62 | + } |
|
63 | 63 | |
64 | - return $value; |
|
65 | - } |
|
64 | + return $value; |
|
65 | + } |
|
66 | 66 | } |
@@ -26,59 +26,59 @@ |
||
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 ??= $_SERVER; |
|
51 | - $queryParams ??= $_GET; |
|
52 | - $cookieParams ??= $_COOKIE; |
|
53 | - $uploadedFiles ??= $_FILES; |
|
54 | - $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 ??= $_SERVER; |
|
51 | + $queryParams ??= $_GET; |
|
52 | + $cookieParams ??= $_COOKIE; |
|
53 | + $uploadedFiles ??= $_FILES; |
|
54 | + $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 | } |
@@ -22,52 +22,52 @@ |
||
22 | 22 | interface HeaderInterface extends IteratorAggregate |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * Date format according to RFC-822 |
|
27 | - * |
|
28 | - * @var string |
|
29 | - */ |
|
30 | - public const RFC822_DATE_FORMAT = 'D, d M y H:i:s O'; |
|
25 | + /** |
|
26 | + * Date format according to RFC-822 |
|
27 | + * |
|
28 | + * @var string |
|
29 | + */ |
|
30 | + public const RFC822_DATE_FORMAT = 'D, d M y H:i:s O'; |
|
31 | 31 | |
32 | - /** |
|
33 | - * Regular Expression used for a token validation according to RFC-7230 |
|
34 | - * |
|
35 | - * @var string |
|
36 | - */ |
|
37 | - public const RFC7230_TOKEN_REGEX = '/^[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7A\x7C\x7E]+$/'; |
|
32 | + /** |
|
33 | + * Regular Expression used for a token validation according to RFC-7230 |
|
34 | + * |
|
35 | + * @var string |
|
36 | + */ |
|
37 | + public const RFC7230_TOKEN_REGEX = '/^[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7A\x7C\x7E]+$/'; |
|
38 | 38 | |
39 | - /** |
|
40 | - * Regular Expression used for a field-value validation according to RFC-7230 |
|
41 | - * |
|
42 | - * @var string |
|
43 | - */ |
|
44 | - public const RFC7230_FIELD_VALUE_REGEX = '/^[\x09\x20-\x7E\x80-\xFF]*$/'; |
|
39 | + /** |
|
40 | + * Regular Expression used for a field-value validation according to RFC-7230 |
|
41 | + * |
|
42 | + * @var string |
|
43 | + */ |
|
44 | + public const RFC7230_FIELD_VALUE_REGEX = '/^[\x09\x20-\x7E\x80-\xFF]*$/'; |
|
45 | 45 | |
46 | - /** |
|
47 | - * Regular Expression used for a quoted-string validation according to RFC-7230 |
|
48 | - * |
|
49 | - * @var string |
|
50 | - */ |
|
51 | - public const RFC7230_QUOTED_STRING_REGEX = '/^(?:[\x5C][\x22]|[\x09\x20\x21\x23-\x5B\x5D-\x7E\x80-\xFF])*$/'; |
|
46 | + /** |
|
47 | + * Regular Expression used for a quoted-string validation according to RFC-7230 |
|
48 | + * |
|
49 | + * @var string |
|
50 | + */ |
|
51 | + public const RFC7230_QUOTED_STRING_REGEX = '/^(?:[\x5C][\x22]|[\x09\x20\x21\x23-\x5B\x5D-\x7E\x80-\xFF])*$/'; |
|
52 | 52 | |
53 | - /** |
|
54 | - * Gets the header field name |
|
55 | - * |
|
56 | - * @return string |
|
57 | - */ |
|
58 | - public function getFieldName(): string; |
|
53 | + /** |
|
54 | + * Gets the header field name |
|
55 | + * |
|
56 | + * @return string |
|
57 | + */ |
|
58 | + public function getFieldName(): string; |
|
59 | 59 | |
60 | - /** |
|
61 | - * Gets the header field value |
|
62 | - * |
|
63 | - * @return string |
|
64 | - */ |
|
65 | - public function getFieldValue(): string; |
|
60 | + /** |
|
61 | + * Gets the header field value |
|
62 | + * |
|
63 | + * @return string |
|
64 | + */ |
|
65 | + public function getFieldValue(): string; |
|
66 | 66 | |
67 | - /** |
|
68 | - * Converts the header to a field |
|
69 | - * |
|
70 | - * @return string |
|
71 | - */ |
|
72 | - public function __toString(): string; |
|
67 | + /** |
|
68 | + * Converts the header to a field |
|
69 | + * |
|
70 | + * @return string |
|
71 | + */ |
|
72 | + public function __toString(): string; |
|
73 | 73 | } |
@@ -31,53 +31,53 @@ |
||
31 | 31 | final class Scheme implements ComponentInterface |
32 | 32 | { |
33 | 33 | |
34 | - /** |
|
35 | - * Regular expression used for the component validation |
|
36 | - * |
|
37 | - * @var string |
|
38 | - */ |
|
39 | - private const VALIDATION_REGEX = '/^(?:[A-Za-z][0-9A-Za-z\x2b\x2d\x2e]*)?$/'; |
|
34 | + /** |
|
35 | + * Regular expression used for the component validation |
|
36 | + * |
|
37 | + * @var string |
|
38 | + */ |
|
39 | + private const VALIDATION_REGEX = '/^(?:[A-Za-z][0-9A-Za-z\x2b\x2d\x2e]*)?$/'; |
|
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::VALIDATION_REGEX, $value)) { |
|
67 | - throw new InvalidUriComponentException('Invalid URI component "scheme"'); |
|
68 | - } |
|
66 | + if (!preg_match(self::VALIDATION_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 | } |
@@ -31,53 +31,53 @@ |
||
31 | 31 | final class Fragment implements ComponentInterface |
32 | 32 | { |
33 | 33 | |
34 | - /** |
|
35 | - * Regular expression used for the component normalization |
|
36 | - * |
|
37 | - * @var string |
|
38 | - */ |
|
39 | - // phpcs:ignore Generic.Files.LineLength |
|
40 | - private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x3b\x3d\x3f-\x5a\x5f\x61-\x7a\x7e])*|(.?)/u'; |
|
34 | + /** |
|
35 | + * Regular expression used for the component normalization |
|
36 | + * |
|
37 | + * @var string |
|
38 | + */ |
|
39 | + // phpcs:ignore Generic.Files.LineLength |
|
40 | + private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x3b\x3d\x3f-\x5a\x5f\x61-\x7a\x7e])*|(.?)/u'; |
|
41 | 41 | |
42 | - /** |
|
43 | - * The component value |
|
44 | - * |
|
45 | - * @var string |
|
46 | - */ |
|
47 | - private string $value = ''; |
|
42 | + /** |
|
43 | + * The component value |
|
44 | + * |
|
45 | + * @var string |
|
46 | + */ |
|
47 | + private string $value = ''; |
|
48 | 48 | |
49 | - /** |
|
50 | - * Constructor of the class |
|
51 | - * |
|
52 | - * @param mixed $value |
|
53 | - * |
|
54 | - * @throws InvalidUriComponentException |
|
55 | - * If the component isn't valid. |
|
56 | - */ |
|
57 | - public function __construct($value) |
|
58 | - { |
|
59 | - if ($value === '') { |
|
60 | - return; |
|
61 | - } |
|
49 | + /** |
|
50 | + * Constructor of the class |
|
51 | + * |
|
52 | + * @param mixed $value |
|
53 | + * |
|
54 | + * @throws InvalidUriComponentException |
|
55 | + * If the component isn't valid. |
|
56 | + */ |
|
57 | + public function __construct($value) |
|
58 | + { |
|
59 | + if ($value === '') { |
|
60 | + return; |
|
61 | + } |
|
62 | 62 | |
63 | - if (!is_string($value)) { |
|
64 | - throw new InvalidUriComponentException('URI component "fragment" must be a string'); |
|
65 | - } |
|
63 | + if (!is_string($value)) { |
|
64 | + throw new InvalidUriComponentException('URI component "fragment" must be a string'); |
|
65 | + } |
|
66 | 66 | |
67 | - $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function (array $match): string { |
|
68 | - /** @var array{0: string, 1?: string} $match */ |
|
67 | + $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function (array $match): string { |
|
68 | + /** @var array{0: string, 1?: string} $match */ |
|
69 | 69 | |
70 | - return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
71 | - }, $value); |
|
72 | - } |
|
70 | + return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
71 | + }, $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 | } |
@@ -64,7 +64,7 @@ |
||
64 | 64 | throw new InvalidUriComponentException('URI component "fragment" must be a string'); |
65 | 65 | } |
66 | 66 | |
67 | - $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function (array $match): string { |
|
67 | + $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function(array $match): string { |
|
68 | 68 | /** @var array{0: string, 1?: string} $match */ |
69 | 69 | |
70 | 70 | return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
@@ -31,71 +31,71 @@ |
||
31 | 31 | final class Password implements ComponentInterface |
32 | 32 | { |
33 | 33 | |
34 | - /** |
|
35 | - * Regular expression used for the component normalization |
|
36 | - * |
|
37 | - * @var string |
|
38 | - */ |
|
39 | - // phpcs:ignore Generic.Files.LineLength |
|
40 | - private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x2e\x30-\x39\x3b\x3d\x41-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u'; |
|
34 | + /** |
|
35 | + * Regular expression used for the component normalization |
|
36 | + * |
|
37 | + * @var string |
|
38 | + */ |
|
39 | + // phpcs:ignore Generic.Files.LineLength |
|
40 | + private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x2e\x30-\x39\x3b\x3d\x41-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u'; |
|
41 | 41 | |
42 | - /** |
|
43 | - * The component value |
|
44 | - * |
|
45 | - * @var string |
|
46 | - */ |
|
47 | - private string $value = ''; |
|
42 | + /** |
|
43 | + * The component value |
|
44 | + * |
|
45 | + * @var string |
|
46 | + */ |
|
47 | + private string $value = ''; |
|
48 | 48 | |
49 | - /** |
|
50 | - * Constructor of the class |
|
51 | - * |
|
52 | - * @param mixed $value |
|
53 | - * |
|
54 | - * @throws InvalidUriComponentException |
|
55 | - * If the component isn't valid. |
|
56 | - */ |
|
57 | - public function __construct($value) |
|
58 | - { |
|
59 | - if ($value === '') { |
|
60 | - return; |
|
61 | - } |
|
49 | + /** |
|
50 | + * Constructor of the class |
|
51 | + * |
|
52 | + * @param mixed $value |
|
53 | + * |
|
54 | + * @throws InvalidUriComponentException |
|
55 | + * If the component isn't valid. |
|
56 | + */ |
|
57 | + public function __construct($value) |
|
58 | + { |
|
59 | + if ($value === '') { |
|
60 | + return; |
|
61 | + } |
|
62 | 62 | |
63 | - if (!is_string($value)) { |
|
64 | - throw new InvalidUriComponentException('URI component "password" must be a string'); |
|
65 | - } |
|
63 | + if (!is_string($value)) { |
|
64 | + throw new InvalidUriComponentException('URI component "password" must be a string'); |
|
65 | + } |
|
66 | 66 | |
67 | - $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function (array $match): string { |
|
68 | - /** @var array{0: string, 1?: string} $match */ |
|
67 | + $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function (array $match): string { |
|
68 | + /** @var array{0: string, 1?: string} $match */ |
|
69 | 69 | |
70 | - return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
71 | - }, $value); |
|
72 | - } |
|
70 | + return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
71 | + }, $value); |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * Creates a password component |
|
76 | - * |
|
77 | - * @param mixed $password |
|
78 | - * |
|
79 | - * @return Password |
|
80 | - * |
|
81 | - * @throws InvalidUriComponentException |
|
82 | - */ |
|
83 | - public static function create($password): Password |
|
84 | - { |
|
85 | - if ($password instanceof Password) { |
|
86 | - return $password; |
|
87 | - } |
|
74 | + /** |
|
75 | + * Creates a password component |
|
76 | + * |
|
77 | + * @param mixed $password |
|
78 | + * |
|
79 | + * @return Password |
|
80 | + * |
|
81 | + * @throws InvalidUriComponentException |
|
82 | + */ |
|
83 | + public static function create($password): Password |
|
84 | + { |
|
85 | + if ($password instanceof Password) { |
|
86 | + return $password; |
|
87 | + } |
|
88 | 88 | |
89 | - return new Password($password); |
|
90 | - } |
|
89 | + return new Password($password); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * {@inheritdoc} |
|
94 | - * |
|
95 | - * @return string |
|
96 | - */ |
|
97 | - public function getValue(): string |
|
98 | - { |
|
99 | - return $this->value; |
|
100 | - } |
|
92 | + /** |
|
93 | + * {@inheritdoc} |
|
94 | + * |
|
95 | + * @return string |
|
96 | + */ |
|
97 | + public function getValue(): string |
|
98 | + { |
|
99 | + return $this->value; |
|
100 | + } |
|
101 | 101 | } |
@@ -64,7 +64,7 @@ |
||
64 | 64 | throw new InvalidUriComponentException('URI component "password" must be a string'); |
65 | 65 | } |
66 | 66 | |
67 | - $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function (array $match): string { |
|
67 | + $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function(array $match): string { |
|
68 | 68 | /** @var array{0: string, 1?: string} $match */ |
69 | 69 | |
70 | 70 | return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
@@ -32,56 +32,56 @@ |
||
32 | 32 | final class Host implements ComponentInterface |
33 | 33 | { |
34 | 34 | |
35 | - /** |
|
36 | - * Regular expression used for the component normalization |
|
37 | - * |
|
38 | - * @var string |
|
39 | - */ |
|
40 | - // phpcs:ignore Generic.Files.LineLength |
|
41 | - private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x2e\x30-\x39\x3b\x3d\x41-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u'; |
|
35 | + /** |
|
36 | + * Regular expression used for the component normalization |
|
37 | + * |
|
38 | + * @var string |
|
39 | + */ |
|
40 | + // phpcs:ignore Generic.Files.LineLength |
|
41 | + private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x2e\x30-\x39\x3b\x3d\x41-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u'; |
|
42 | 42 | |
43 | - /** |
|
44 | - * The component value |
|
45 | - * |
|
46 | - * @var string |
|
47 | - */ |
|
48 | - private string $value = ''; |
|
43 | + /** |
|
44 | + * The component value |
|
45 | + * |
|
46 | + * @var string |
|
47 | + */ |
|
48 | + private string $value = ''; |
|
49 | 49 | |
50 | - /** |
|
51 | - * Constructor of the class |
|
52 | - * |
|
53 | - * @param mixed $value |
|
54 | - * |
|
55 | - * @throws InvalidUriComponentException |
|
56 | - * If the component isn't valid. |
|
57 | - */ |
|
58 | - public function __construct($value) |
|
59 | - { |
|
60 | - if ($value === '') { |
|
61 | - return; |
|
62 | - } |
|
50 | + /** |
|
51 | + * Constructor of the class |
|
52 | + * |
|
53 | + * @param mixed $value |
|
54 | + * |
|
55 | + * @throws InvalidUriComponentException |
|
56 | + * If the component isn't valid. |
|
57 | + */ |
|
58 | + public function __construct($value) |
|
59 | + { |
|
60 | + if ($value === '') { |
|
61 | + return; |
|
62 | + } |
|
63 | 63 | |
64 | - if (!is_string($value)) { |
|
65 | - throw new InvalidUriComponentException('URI component "host" must be a string'); |
|
66 | - } |
|
64 | + if (!is_string($value)) { |
|
65 | + throw new InvalidUriComponentException('URI component "host" must be a string'); |
|
66 | + } |
|
67 | 67 | |
68 | - $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function (array $match): string { |
|
69 | - /** @var array{0: string, 1?: string} $match */ |
|
68 | + $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function (array $match): string { |
|
69 | + /** @var array{0: string, 1?: string} $match */ |
|
70 | 70 | |
71 | - return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
72 | - }, $value); |
|
71 | + return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
72 | + }, $value); |
|
73 | 73 | |
74 | - // the component is case-insensitive... |
|
75 | - $this->value = strtolower($this->value); |
|
76 | - } |
|
74 | + // the component is case-insensitive... |
|
75 | + $this->value = strtolower($this->value); |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * {@inheritdoc} |
|
80 | - * |
|
81 | - * @return string |
|
82 | - */ |
|
83 | - public function getValue(): string |
|
84 | - { |
|
85 | - return $this->value; |
|
86 | - } |
|
78 | + /** |
|
79 | + * {@inheritdoc} |
|
80 | + * |
|
81 | + * @return string |
|
82 | + */ |
|
83 | + public function getValue(): string |
|
84 | + { |
|
85 | + return $this->value; |
|
86 | + } |
|
87 | 87 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | throw new InvalidUriComponentException('URI component "host" must be a string'); |
66 | 66 | } |
67 | 67 | |
68 | - $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function (array $match): string { |
|
68 | + $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function(array $match): string { |
|
69 | 69 | /** @var array{0: string, 1?: string} $match */ |
70 | 70 | |
71 | 71 | return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
@@ -31,53 +31,53 @@ |
||
31 | 31 | final class Path implements ComponentInterface |
32 | 32 | { |
33 | 33 | |
34 | - /** |
|
35 | - * Regular expression used for the component normalization |
|
36 | - * |
|
37 | - * @var string |
|
38 | - */ |
|
39 | - // phpcs:ignore Generic.Files.LineLength |
|
40 | - private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x3b\x3d\x40-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u'; |
|
34 | + /** |
|
35 | + * Regular expression used for the component normalization |
|
36 | + * |
|
37 | + * @var string |
|
38 | + */ |
|
39 | + // phpcs:ignore Generic.Files.LineLength |
|
40 | + private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x3b\x3d\x40-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u'; |
|
41 | 41 | |
42 | - /** |
|
43 | - * The component value |
|
44 | - * |
|
45 | - * @var string |
|
46 | - */ |
|
47 | - private string $value = ''; |
|
42 | + /** |
|
43 | + * The component value |
|
44 | + * |
|
45 | + * @var string |
|
46 | + */ |
|
47 | + private string $value = ''; |
|
48 | 48 | |
49 | - /** |
|
50 | - * Constructor of the class |
|
51 | - * |
|
52 | - * @param mixed $value |
|
53 | - * |
|
54 | - * @throws InvalidUriComponentException |
|
55 | - * If the component isn't valid. |
|
56 | - */ |
|
57 | - public function __construct($value) |
|
58 | - { |
|
59 | - if ($value === '') { |
|
60 | - return; |
|
61 | - } |
|
49 | + /** |
|
50 | + * Constructor of the class |
|
51 | + * |
|
52 | + * @param mixed $value |
|
53 | + * |
|
54 | + * @throws InvalidUriComponentException |
|
55 | + * If the component isn't valid. |
|
56 | + */ |
|
57 | + public function __construct($value) |
|
58 | + { |
|
59 | + if ($value === '') { |
|
60 | + return; |
|
61 | + } |
|
62 | 62 | |
63 | - if (!is_string($value)) { |
|
64 | - throw new InvalidUriComponentException('URI component "path" must be a string'); |
|
65 | - } |
|
63 | + if (!is_string($value)) { |
|
64 | + throw new InvalidUriComponentException('URI component "path" must be a string'); |
|
65 | + } |
|
66 | 66 | |
67 | - $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function (array $match): string { |
|
68 | - /** @var array{0: string, 1?: string} $match */ |
|
67 | + $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function (array $match): string { |
|
68 | + /** @var array{0: string, 1?: string} $match */ |
|
69 | 69 | |
70 | - return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
71 | - }, $value); |
|
72 | - } |
|
70 | + return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
71 | + }, $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 | } |
@@ -64,7 +64,7 @@ |
||
64 | 64 | throw new InvalidUriComponentException('URI component "path" must be a string'); |
65 | 65 | } |
66 | 66 | |
67 | - $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function (array $match): string { |
|
67 | + $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function(array $match): string { |
|
68 | 68 | /** @var array{0: string, 1?: string} $match */ |
69 | 69 | |
70 | 70 | return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
@@ -31,53 +31,53 @@ |
||
31 | 31 | final class Query implements ComponentInterface |
32 | 32 | { |
33 | 33 | |
34 | - /** |
|
35 | - * Regular expression used for the component normalization |
|
36 | - * |
|
37 | - * @var string |
|
38 | - */ |
|
39 | - // phpcs:ignore Generic.Files.LineLength |
|
40 | - private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x3b\x3d\x3f-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u'; |
|
34 | + /** |
|
35 | + * Regular expression used for the component normalization |
|
36 | + * |
|
37 | + * @var string |
|
38 | + */ |
|
39 | + // phpcs:ignore Generic.Files.LineLength |
|
40 | + private const NORMALIZATION_REGEX = '/(?:%[0-9A-Fa-f]{2}|[\x21\x24\x26-\x3b\x3d\x3f-\x5a\x5f\x61-\x7a\x7e]+)|(.?)/u'; |
|
41 | 41 | |
42 | - /** |
|
43 | - * The component value |
|
44 | - * |
|
45 | - * @var string |
|
46 | - */ |
|
47 | - private string $value = ''; |
|
42 | + /** |
|
43 | + * The component value |
|
44 | + * |
|
45 | + * @var string |
|
46 | + */ |
|
47 | + private string $value = ''; |
|
48 | 48 | |
49 | - /** |
|
50 | - * Constructor of the class |
|
51 | - * |
|
52 | - * @param mixed $value |
|
53 | - * |
|
54 | - * @throws InvalidUriComponentException |
|
55 | - * If the component isn't valid. |
|
56 | - */ |
|
57 | - public function __construct($value) |
|
58 | - { |
|
59 | - if ($value === '') { |
|
60 | - return; |
|
61 | - } |
|
49 | + /** |
|
50 | + * Constructor of the class |
|
51 | + * |
|
52 | + * @param mixed $value |
|
53 | + * |
|
54 | + * @throws InvalidUriComponentException |
|
55 | + * If the component isn't valid. |
|
56 | + */ |
|
57 | + public function __construct($value) |
|
58 | + { |
|
59 | + if ($value === '') { |
|
60 | + return; |
|
61 | + } |
|
62 | 62 | |
63 | - if (!is_string($value)) { |
|
64 | - throw new InvalidUriComponentException('URI component "query" must be a string'); |
|
65 | - } |
|
63 | + if (!is_string($value)) { |
|
64 | + throw new InvalidUriComponentException('URI component "query" must be a string'); |
|
65 | + } |
|
66 | 66 | |
67 | - $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function (array $match): string { |
|
68 | - /** @var array{0: string, 1?: string} $match */ |
|
67 | + $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function (array $match): string { |
|
68 | + /** @var array{0: string, 1?: string} $match */ |
|
69 | 69 | |
70 | - return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
71 | - }, $value); |
|
72 | - } |
|
70 | + return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
71 | + }, $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 | } |
@@ -64,7 +64,7 @@ |
||
64 | 64 | throw new InvalidUriComponentException('URI component "query" must be a string'); |
65 | 65 | } |
66 | 66 | |
67 | - $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function (array $match): string { |
|
67 | + $this->value = preg_replace_callback(self::NORMALIZATION_REGEX, function(array $match): string { |
|
68 | 68 | /** @var array{0: string, 1?: string} $match */ |
69 | 69 | |
70 | 70 | return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |