@@ -17,10 +17,10 @@ |
||
17 | 17 | interface ComponentInterface |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * Gets the component value |
|
22 | - * |
|
23 | - * @return mixed |
|
24 | - */ |
|
25 | - public function getValue(); |
|
20 | + /** |
|
21 | + * Gets the component value |
|
22 | + * |
|
23 | + * @return mixed |
|
24 | + */ |
|
25 | + public function getValue(); |
|
26 | 26 | } |
@@ -31,52 +31,52 @@ |
||
31 | 31 | final class Password implements ComponentInterface |
32 | 32 | { |
33 | 33 | |
34 | - /** |
|
35 | - * Regular expression to normalize the component value |
|
36 | - * |
|
37 | - * @var string |
|
38 | - */ |
|
39 | - private const NORMALIZE_REGEX = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=]+)|(.?))/u'; |
|
34 | + /** |
|
35 | + * Regular expression to normalize the component value |
|
36 | + * |
|
37 | + * @var string |
|
38 | + */ |
|
39 | + private const NORMALIZE_REGEX = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=]+)|(.?))/u'; |
|
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 "password" must be a string'); |
|
64 | - } |
|
62 | + if (!is_string($value)) { |
|
63 | + throw new InvalidUriComponentException('URI component "password" must be a string'); |
|
64 | + } |
|
65 | 65 | |
66 | - $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function (array $match): string { |
|
67 | - /** @var array{0: string, 1?: string} $match */ |
|
66 | + $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function (array $match): string { |
|
67 | + /** @var array{0: string, 1?: string} $match */ |
|
68 | 68 | |
69 | - return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
70 | - }, $value); |
|
71 | - } |
|
69 | + return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
70 | + }, $value); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * {@inheritdoc} |
|
75 | - * |
|
76 | - * @return string |
|
77 | - */ |
|
78 | - public function getValue(): string |
|
79 | - { |
|
80 | - return $this->value; |
|
81 | - } |
|
73 | + /** |
|
74 | + * {@inheritdoc} |
|
75 | + * |
|
76 | + * @return string |
|
77 | + */ |
|
78 | + public function getValue(): string |
|
79 | + { |
|
80 | + return $this->value; |
|
81 | + } |
|
82 | 82 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | throw new InvalidUriComponentException('URI component "password" must be a string'); |
64 | 64 | } |
65 | 65 | |
66 | - $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function (array $match): string { |
|
66 | + $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function(array $match): string { |
|
67 | 67 | /** @var array{0: string, 1?: string} $match */ |
68 | 68 | |
69 | 69 | return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
@@ -32,55 +32,55 @@ |
||
32 | 32 | final class Host implements ComponentInterface |
33 | 33 | { |
34 | 34 | |
35 | - /** |
|
36 | - * Regular expression to normalize the component value |
|
37 | - * |
|
38 | - * @var string |
|
39 | - */ |
|
40 | - private const NORMALIZE_REGEX = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=]+)|(.?))/u'; |
|
35 | + /** |
|
36 | + * Regular expression to normalize the component value |
|
37 | + * |
|
38 | + * @var string |
|
39 | + */ |
|
40 | + private const NORMALIZE_REGEX = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=]+)|(.?))/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 "host" must be a string'); |
|
65 | - } |
|
63 | + if (!is_string($value)) { |
|
64 | + throw new InvalidUriComponentException('URI component "host" must be a string'); |
|
65 | + } |
|
66 | 66 | |
67 | - $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function (array $match): string { |
|
68 | - /** @var array{0: string, 1?: string} $match */ |
|
67 | + $this->value = preg_replace_callback(self::NORMALIZE_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); |
|
70 | + return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
71 | + }, $value); |
|
72 | 72 | |
73 | - // the component is case-insensitive... |
|
74 | - $this->value = strtolower($this->value); |
|
75 | - } |
|
73 | + // the component is case-insensitive... |
|
74 | + $this->value = strtolower($this->value); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * {@inheritdoc} |
|
79 | - * |
|
80 | - * @return string |
|
81 | - */ |
|
82 | - public function getValue(): string |
|
83 | - { |
|
84 | - return $this->value; |
|
85 | - } |
|
77 | + /** |
|
78 | + * {@inheritdoc} |
|
79 | + * |
|
80 | + * @return string |
|
81 | + */ |
|
82 | + public function getValue(): string |
|
83 | + { |
|
84 | + return $this->value; |
|
85 | + } |
|
86 | 86 | } |
@@ -64,7 +64,7 @@ |
||
64 | 64 | throw new InvalidUriComponentException('URI component "host" must be a string'); |
65 | 65 | } |
66 | 66 | |
67 | - $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function (array $match): string { |
|
67 | + $this->value = preg_replace_callback(self::NORMALIZE_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]; |
@@ -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 instanceof User ? $user : new User($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 instanceof User ? $user : new User($user); |
|
45 | 45 | |
46 | - if (isset($password)) { |
|
47 | - $this->password = $password instanceof Password ? $password : new Password($password); |
|
48 | - } |
|
49 | - } |
|
46 | + if (isset($password)) { |
|
47 | + $this->password = $password instanceof Password ? $password : new Password($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 | } |
@@ -31,52 +31,52 @@ |
||
31 | 31 | final class Path implements ComponentInterface |
32 | 32 | { |
33 | 33 | |
34 | - /** |
|
35 | - * Regular expression to normalize the component value |
|
36 | - * |
|
37 | - * @var string |
|
38 | - */ |
|
39 | - private const NORMALIZE_REGEX = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=\:@\/]+)|(.?))/u'; |
|
34 | + /** |
|
35 | + * Regular expression to normalize the component value |
|
36 | + * |
|
37 | + * @var string |
|
38 | + */ |
|
39 | + private const NORMALIZE_REGEX = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=\:@\/]+)|(.?))/u'; |
|
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 "path" must be a string'); |
|
64 | - } |
|
62 | + if (!is_string($value)) { |
|
63 | + throw new InvalidUriComponentException('URI component "path" must be a string'); |
|
64 | + } |
|
65 | 65 | |
66 | - $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function (array $match): string { |
|
67 | - /** @var array{0: string, 1?: string} $match */ |
|
66 | + $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function (array $match): string { |
|
67 | + /** @var array{0: string, 1?: string} $match */ |
|
68 | 68 | |
69 | - return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
70 | - }, $value); |
|
71 | - } |
|
69 | + return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
70 | + }, $value); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * {@inheritdoc} |
|
75 | - * |
|
76 | - * @return string |
|
77 | - */ |
|
78 | - public function getValue(): string |
|
79 | - { |
|
80 | - return $this->value; |
|
81 | - } |
|
73 | + /** |
|
74 | + * {@inheritdoc} |
|
75 | + * |
|
76 | + * @return string |
|
77 | + */ |
|
78 | + public function getValue(): string |
|
79 | + { |
|
80 | + return $this->value; |
|
81 | + } |
|
82 | 82 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | throw new InvalidUriComponentException('URI component "path" must be a string'); |
64 | 64 | } |
65 | 65 | |
66 | - $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function (array $match): string { |
|
66 | + $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function(array $match): string { |
|
67 | 67 | /** @var array{0: string, 1?: string} $match */ |
68 | 68 | |
69 | 69 | return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
@@ -31,52 +31,52 @@ |
||
31 | 31 | final class Query implements ComponentInterface |
32 | 32 | { |
33 | 33 | |
34 | - /** |
|
35 | - * Regular expression to normalize the component value |
|
36 | - * |
|
37 | - * @var string |
|
38 | - */ |
|
39 | - private const NORMALIZE_REGEX = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=\:@\/\?]+)|(.?))/u'; |
|
34 | + /** |
|
35 | + * Regular expression to normalize the component value |
|
36 | + * |
|
37 | + * @var string |
|
38 | + */ |
|
39 | + private const NORMALIZE_REGEX = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=\:@\/\?]+)|(.?))/u'; |
|
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 "query" must be a string'); |
|
64 | - } |
|
62 | + if (!is_string($value)) { |
|
63 | + throw new InvalidUriComponentException('URI component "query" must be a string'); |
|
64 | + } |
|
65 | 65 | |
66 | - $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function (array $match): string { |
|
67 | - /** @var array{0: string, 1?: string} $match */ |
|
66 | + $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function (array $match): string { |
|
67 | + /** @var array{0: string, 1?: string} $match */ |
|
68 | 68 | |
69 | - return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
70 | - }, $value); |
|
71 | - } |
|
69 | + return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
70 | + }, $value); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * {@inheritdoc} |
|
75 | - * |
|
76 | - * @return string |
|
77 | - */ |
|
78 | - public function getValue(): string |
|
79 | - { |
|
80 | - return $this->value; |
|
81 | - } |
|
73 | + /** |
|
74 | + * {@inheritdoc} |
|
75 | + * |
|
76 | + * @return string |
|
77 | + */ |
|
78 | + public function getValue(): string |
|
79 | + { |
|
80 | + return $this->value; |
|
81 | + } |
|
82 | 82 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | throw new InvalidUriComponentException('URI component "query" must be a string'); |
64 | 64 | } |
65 | 65 | |
66 | - $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function (array $match): string { |
|
66 | + $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function(array $match): string { |
|
67 | 67 | /** @var array{0: string, 1?: string} $match */ |
68 | 68 | |
69 | 69 | return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
@@ -29,48 +29,48 @@ |
||
29 | 29 | final class Port implements ComponentInterface |
30 | 30 | { |
31 | 31 | |
32 | - /** |
|
33 | - * The component value |
|
34 | - * |
|
35 | - * @var int|null |
|
36 | - */ |
|
37 | - private ?int $value = null; |
|
32 | + /** |
|
33 | + * The component value |
|
34 | + * |
|
35 | + * @var int|null |
|
36 | + */ |
|
37 | + private ?int $value = null; |
|
38 | 38 | |
39 | - /** |
|
40 | - * Constructor of the class |
|
41 | - * |
|
42 | - * @param mixed $value |
|
43 | - * |
|
44 | - * @throws InvalidUriComponentException |
|
45 | - * If the component isn't valid. |
|
46 | - */ |
|
47 | - public function __construct($value) |
|
48 | - { |
|
49 | - $min = 1; |
|
50 | - $max = (2 ** 16) - 1; |
|
39 | + /** |
|
40 | + * Constructor of the class |
|
41 | + * |
|
42 | + * @param mixed $value |
|
43 | + * |
|
44 | + * @throws InvalidUriComponentException |
|
45 | + * If the component isn't valid. |
|
46 | + */ |
|
47 | + public function __construct($value) |
|
48 | + { |
|
49 | + $min = 1; |
|
50 | + $max = (2 ** 16) - 1; |
|
51 | 51 | |
52 | - if ($value === null) { |
|
53 | - return; |
|
54 | - } |
|
52 | + if ($value === null) { |
|
53 | + return; |
|
54 | + } |
|
55 | 55 | |
56 | - if (!is_int($value)) { |
|
57 | - throw new InvalidUriComponentException('URI component "port" must be an integer'); |
|
58 | - } |
|
56 | + if (!is_int($value)) { |
|
57 | + throw new InvalidUriComponentException('URI component "port" must be an integer'); |
|
58 | + } |
|
59 | 59 | |
60 | - if (!($value >= $min && $value <= $max)) { |
|
61 | - throw new InvalidUriComponentException('Invalid URI component "port"'); |
|
62 | - } |
|
60 | + if (!($value >= $min && $value <= $max)) { |
|
61 | + throw new InvalidUriComponentException('Invalid URI component "port"'); |
|
62 | + } |
|
63 | 63 | |
64 | - $this->value = $value; |
|
65 | - } |
|
64 | + $this->value = $value; |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * {@inheritdoc} |
|
69 | - * |
|
70 | - * @return int|null |
|
71 | - */ |
|
72 | - public function getValue(): ?int |
|
73 | - { |
|
74 | - return $this->value; |
|
75 | - } |
|
67 | + /** |
|
68 | + * {@inheritdoc} |
|
69 | + * |
|
70 | + * @return int|null |
|
71 | + */ |
|
72 | + public function getValue(): ?int |
|
73 | + { |
|
74 | + return $this->value; |
|
75 | + } |
|
76 | 76 | } |
@@ -31,52 +31,52 @@ |
||
31 | 31 | final class User implements ComponentInterface |
32 | 32 | { |
33 | 33 | |
34 | - /** |
|
35 | - * Regular expression to normalize the component value |
|
36 | - * |
|
37 | - * @var string |
|
38 | - */ |
|
39 | - private const NORMALIZE_REGEX = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=]+)|(.?))/u'; |
|
34 | + /** |
|
35 | + * Regular expression to normalize the component value |
|
36 | + * |
|
37 | + * @var string |
|
38 | + */ |
|
39 | + private const NORMALIZE_REGEX = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=]+)|(.?))/u'; |
|
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 "user" must be a string'); |
|
64 | - } |
|
62 | + if (!is_string($value)) { |
|
63 | + throw new InvalidUriComponentException('URI component "user" must be a string'); |
|
64 | + } |
|
65 | 65 | |
66 | - $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function (array $match): string { |
|
67 | - /** @var array{0: string, 1?: string} $match */ |
|
66 | + $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function (array $match): string { |
|
67 | + /** @var array{0: string, 1?: string} $match */ |
|
68 | 68 | |
69 | - return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
70 | - }, $value); |
|
71 | - } |
|
69 | + return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
|
70 | + }, $value); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * {@inheritdoc} |
|
75 | - * |
|
76 | - * @return string |
|
77 | - */ |
|
78 | - public function getValue(): string |
|
79 | - { |
|
80 | - return $this->value; |
|
81 | - } |
|
73 | + /** |
|
74 | + * {@inheritdoc} |
|
75 | + * |
|
76 | + * @return string |
|
77 | + */ |
|
78 | + public function getValue(): string |
|
79 | + { |
|
80 | + return $this->value; |
|
81 | + } |
|
82 | 82 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | throw new InvalidUriComponentException('URI component "user" must be a string'); |
64 | 64 | } |
65 | 65 | |
66 | - $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function (array $match): string { |
|
66 | + $this->value = preg_replace_callback(self::NORMALIZE_REGEX, function(array $match): string { |
|
67 | 67 | /** @var array{0: string, 1?: string} $match */ |
68 | 68 | |
69 | 69 | return isset($match[1]) ? rawurlencode($match[1]) : $match[0]; |
@@ -29,20 +29,20 @@ |
||
29 | 29 | class PhpTempStream extends Stream |
30 | 30 | { |
31 | 31 | |
32 | - /** |
|
33 | - * Constructor of the class |
|
34 | - * |
|
35 | - * @param string $mode |
|
36 | - * @param int $maxmemory |
|
37 | - * |
|
38 | - * @throws InvalidArgumentException |
|
39 | - */ |
|
40 | - public function __construct(string $mode = 'r+b', int $maxmemory = 2097152) |
|
41 | - { |
|
42 | - if ($maxmemory < 0) { |
|
43 | - throw new InvalidArgumentException('Argument #2 ($maxmemory) must be greater than or equal to 0'); |
|
44 | - } |
|
32 | + /** |
|
33 | + * Constructor of the class |
|
34 | + * |
|
35 | + * @param string $mode |
|
36 | + * @param int $maxmemory |
|
37 | + * |
|
38 | + * @throws InvalidArgumentException |
|
39 | + */ |
|
40 | + public function __construct(string $mode = 'r+b', int $maxmemory = 2097152) |
|
41 | + { |
|
42 | + if ($maxmemory < 0) { |
|
43 | + throw new InvalidArgumentException('Argument #2 ($maxmemory) must be greater than or equal to 0'); |
|
44 | + } |
|
45 | 45 | |
46 | - parent::__construct(fopen(sprintf('php://temp/maxmemory:%d', $maxmemory), $mode)); |
|
47 | - } |
|
46 | + parent::__construct(fopen(sprintf('php://temp/maxmemory:%d', $maxmemory), $mode)); |
|
47 | + } |
|
48 | 48 | } |