@@ -28,60 +28,60 @@ |
||
28 | 28 | class AgeHeader extends Header |
29 | 29 | { |
30 | 30 | |
31 | - /** |
|
32 | - * @var int |
|
33 | - */ |
|
34 | - private int $value; |
|
31 | + /** |
|
32 | + * @var int |
|
33 | + */ |
|
34 | + private int $value; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Constructor of the class |
|
38 | - * |
|
39 | - * @param int $value |
|
40 | - * |
|
41 | - * @throws InvalidHeaderValueException |
|
42 | - * If the value isn't valid. |
|
43 | - */ |
|
44 | - public function __construct(int $value) |
|
45 | - { |
|
46 | - $this->validateValue($value); |
|
36 | + /** |
|
37 | + * Constructor of the class |
|
38 | + * |
|
39 | + * @param int $value |
|
40 | + * |
|
41 | + * @throws InvalidHeaderValueException |
|
42 | + * If the value isn't valid. |
|
43 | + */ |
|
44 | + public function __construct(int $value) |
|
45 | + { |
|
46 | + $this->validateValue($value); |
|
47 | 47 | |
48 | - $this->value = $value; |
|
49 | - } |
|
48 | + $this->value = $value; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * {@inheritdoc} |
|
53 | - */ |
|
54 | - public function getFieldName(): string |
|
55 | - { |
|
56 | - return 'Age'; |
|
57 | - } |
|
51 | + /** |
|
52 | + * {@inheritdoc} |
|
53 | + */ |
|
54 | + public function getFieldName(): string |
|
55 | + { |
|
56 | + return 'Age'; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * {@inheritdoc} |
|
61 | - */ |
|
62 | - public function getFieldValue(): string |
|
63 | - { |
|
64 | - return sprintf('%d', $this->value); |
|
65 | - } |
|
59 | + /** |
|
60 | + * {@inheritdoc} |
|
61 | + */ |
|
62 | + public function getFieldValue(): string |
|
63 | + { |
|
64 | + return sprintf('%d', $this->value); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Validates the given value |
|
69 | - * |
|
70 | - * @param int $value |
|
71 | - * |
|
72 | - * @return void |
|
73 | - * |
|
74 | - * @throws InvalidHeaderValueException |
|
75 | - * If the value isn't valid. |
|
76 | - */ |
|
77 | - private function validateValue(int $value): void |
|
78 | - { |
|
79 | - if (! ($value >= 0)) { |
|
80 | - throw new InvalidHeaderValueException(sprintf( |
|
81 | - 'The value "%2$d" for the header "%1$s" is not valid', |
|
82 | - $this->getFieldName(), |
|
83 | - $value |
|
84 | - )); |
|
85 | - } |
|
86 | - } |
|
67 | + /** |
|
68 | + * Validates the given value |
|
69 | + * |
|
70 | + * @param int $value |
|
71 | + * |
|
72 | + * @return void |
|
73 | + * |
|
74 | + * @throws InvalidHeaderValueException |
|
75 | + * If the value isn't valid. |
|
76 | + */ |
|
77 | + private function validateValue(int $value): void |
|
78 | + { |
|
79 | + if (! ($value >= 0)) { |
|
80 | + throw new InvalidHeaderValueException(sprintf( |
|
81 | + 'The value "%2$d" for the header "%1$s" is not valid', |
|
82 | + $this->getFieldName(), |
|
83 | + $value |
|
84 | + )); |
|
85 | + } |
|
86 | + } |
|
87 | 87 | } |
@@ -76,7 +76,7 @@ |
||
76 | 76 | */ |
77 | 77 | private function validateValue(int $value): void |
78 | 78 | { |
79 | - if (! ($value >= 0)) { |
|
79 | + if (!($value >= 0)) { |
|
80 | 80 | throw new InvalidHeaderValueException(sprintf( |
81 | 81 | 'The value "%2$d" for the header "%1$s" is not valid', |
82 | 82 | $this->getFieldName(), |
@@ -24,34 +24,34 @@ |
||
24 | 24 | class RetryAfterHeader extends Header |
25 | 25 | { |
26 | 26 | |
27 | - /** |
|
28 | - * @var DateTimeInterface |
|
29 | - */ |
|
30 | - private DateTimeInterface $timestamp; |
|
31 | - |
|
32 | - /** |
|
33 | - * Constructor of the class |
|
34 | - * |
|
35 | - * @param DateTimeInterface $timestamp |
|
36 | - */ |
|
37 | - public function __construct(DateTimeInterface $timestamp) |
|
38 | - { |
|
39 | - $this->timestamp = $timestamp; |
|
40 | - } |
|
41 | - |
|
42 | - /** |
|
43 | - * {@inheritdoc} |
|
44 | - */ |
|
45 | - public function getFieldName(): string |
|
46 | - { |
|
47 | - return 'Retry-After'; |
|
48 | - } |
|
49 | - |
|
50 | - /** |
|
51 | - * {@inheritdoc} |
|
52 | - */ |
|
53 | - public function getFieldValue(): string |
|
54 | - { |
|
55 | - return $this->formatDateTime($this->timestamp); |
|
56 | - } |
|
27 | + /** |
|
28 | + * @var DateTimeInterface |
|
29 | + */ |
|
30 | + private DateTimeInterface $timestamp; |
|
31 | + |
|
32 | + /** |
|
33 | + * Constructor of the class |
|
34 | + * |
|
35 | + * @param DateTimeInterface $timestamp |
|
36 | + */ |
|
37 | + public function __construct(DateTimeInterface $timestamp) |
|
38 | + { |
|
39 | + $this->timestamp = $timestamp; |
|
40 | + } |
|
41 | + |
|
42 | + /** |
|
43 | + * {@inheritdoc} |
|
44 | + */ |
|
45 | + public function getFieldName(): string |
|
46 | + { |
|
47 | + return 'Retry-After'; |
|
48 | + } |
|
49 | + |
|
50 | + /** |
|
51 | + * {@inheritdoc} |
|
52 | + */ |
|
53 | + public function getFieldValue(): string |
|
54 | + { |
|
55 | + return $this->formatDateTime($this->timestamp); |
|
56 | + } |
|
57 | 57 | } |
@@ -24,34 +24,34 @@ |
||
24 | 24 | class LastModifiedHeader extends Header |
25 | 25 | { |
26 | 26 | |
27 | - /** |
|
28 | - * @var DateTimeInterface |
|
29 | - */ |
|
30 | - private DateTimeInterface $timestamp; |
|
31 | - |
|
32 | - /** |
|
33 | - * Constructor of the class |
|
34 | - * |
|
35 | - * @param DateTimeInterface $timestamp |
|
36 | - */ |
|
37 | - public function __construct(DateTimeInterface $timestamp) |
|
38 | - { |
|
39 | - $this->timestamp = $timestamp; |
|
40 | - } |
|
41 | - |
|
42 | - /** |
|
43 | - * {@inheritdoc} |
|
44 | - */ |
|
45 | - public function getFieldName(): string |
|
46 | - { |
|
47 | - return 'Last-Modified'; |
|
48 | - } |
|
49 | - |
|
50 | - /** |
|
51 | - * {@inheritdoc} |
|
52 | - */ |
|
53 | - public function getFieldValue(): string |
|
54 | - { |
|
55 | - return $this->formatDateTime($this->timestamp); |
|
56 | - } |
|
27 | + /** |
|
28 | + * @var DateTimeInterface |
|
29 | + */ |
|
30 | + private DateTimeInterface $timestamp; |
|
31 | + |
|
32 | + /** |
|
33 | + * Constructor of the class |
|
34 | + * |
|
35 | + * @param DateTimeInterface $timestamp |
|
36 | + */ |
|
37 | + public function __construct(DateTimeInterface $timestamp) |
|
38 | + { |
|
39 | + $this->timestamp = $timestamp; |
|
40 | + } |
|
41 | + |
|
42 | + /** |
|
43 | + * {@inheritdoc} |
|
44 | + */ |
|
45 | + public function getFieldName(): string |
|
46 | + { |
|
47 | + return 'Last-Modified'; |
|
48 | + } |
|
49 | + |
|
50 | + /** |
|
51 | + * {@inheritdoc} |
|
52 | + */ |
|
53 | + public function getFieldValue(): string |
|
54 | + { |
|
55 | + return $this->formatDateTime($this->timestamp); |
|
56 | + } |
|
57 | 57 | } |
@@ -23,49 +23,49 @@ |
||
23 | 23 | class ConnectionHeader extends Header |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * @var string |
|
28 | - */ |
|
29 | - public const CONNECTION_CLOSE = 'close'; |
|
26 | + /** |
|
27 | + * @var string |
|
28 | + */ |
|
29 | + public const CONNECTION_CLOSE = 'close'; |
|
30 | 30 | |
31 | - /** |
|
32 | - * @var string |
|
33 | - */ |
|
34 | - public const CONNECTION_KEEP_ALIVE = 'keep-alive'; |
|
31 | + /** |
|
32 | + * @var string |
|
33 | + */ |
|
34 | + public const CONNECTION_KEEP_ALIVE = 'keep-alive'; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @var string |
|
38 | - */ |
|
39 | - private string $value; |
|
36 | + /** |
|
37 | + * @var string |
|
38 | + */ |
|
39 | + private string $value; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Constructor of the class |
|
43 | - * |
|
44 | - * @param string $value |
|
45 | - * |
|
46 | - * @throws InvalidHeaderValueException |
|
47 | - * If the value isn't valid. |
|
48 | - */ |
|
49 | - public function __construct(string $value) |
|
50 | - { |
|
51 | - $this->validateToken($value); |
|
41 | + /** |
|
42 | + * Constructor of the class |
|
43 | + * |
|
44 | + * @param string $value |
|
45 | + * |
|
46 | + * @throws InvalidHeaderValueException |
|
47 | + * If the value isn't valid. |
|
48 | + */ |
|
49 | + public function __construct(string $value) |
|
50 | + { |
|
51 | + $this->validateToken($value); |
|
52 | 52 | |
53 | - $this->value = $value; |
|
54 | - } |
|
53 | + $this->value = $value; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * {@inheritdoc} |
|
58 | - */ |
|
59 | - public function getFieldName(): string |
|
60 | - { |
|
61 | - return 'Connection'; |
|
62 | - } |
|
56 | + /** |
|
57 | + * {@inheritdoc} |
|
58 | + */ |
|
59 | + public function getFieldName(): string |
|
60 | + { |
|
61 | + return 'Connection'; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * {@inheritdoc} |
|
66 | - */ |
|
67 | - public function getFieldValue(): string |
|
68 | - { |
|
69 | - return $this->value; |
|
70 | - } |
|
64 | + /** |
|
65 | + * {@inheritdoc} |
|
66 | + */ |
|
67 | + public function getFieldValue(): string |
|
68 | + { |
|
69 | + return $this->value; |
|
70 | + } |
|
71 | 71 | } |
@@ -28,60 +28,60 @@ |
||
28 | 28 | class AccessControlMaxAgeHeader extends Header |
29 | 29 | { |
30 | 30 | |
31 | - /** |
|
32 | - * @var int |
|
33 | - */ |
|
34 | - private int $value; |
|
31 | + /** |
|
32 | + * @var int |
|
33 | + */ |
|
34 | + private int $value; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Constructor of the class |
|
38 | - * |
|
39 | - * @param int $value |
|
40 | - * |
|
41 | - * @throws InvalidHeaderValueException |
|
42 | - * If the value isn't valid. |
|
43 | - */ |
|
44 | - public function __construct(int $value) |
|
45 | - { |
|
46 | - $this->validateValue($value); |
|
36 | + /** |
|
37 | + * Constructor of the class |
|
38 | + * |
|
39 | + * @param int $value |
|
40 | + * |
|
41 | + * @throws InvalidHeaderValueException |
|
42 | + * If the value isn't valid. |
|
43 | + */ |
|
44 | + public function __construct(int $value) |
|
45 | + { |
|
46 | + $this->validateValue($value); |
|
47 | 47 | |
48 | - $this->value = $value; |
|
49 | - } |
|
48 | + $this->value = $value; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * {@inheritdoc} |
|
53 | - */ |
|
54 | - public function getFieldName(): string |
|
55 | - { |
|
56 | - return 'Access-Control-Max-Age'; |
|
57 | - } |
|
51 | + /** |
|
52 | + * {@inheritdoc} |
|
53 | + */ |
|
54 | + public function getFieldName(): string |
|
55 | + { |
|
56 | + return 'Access-Control-Max-Age'; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * {@inheritdoc} |
|
61 | - */ |
|
62 | - public function getFieldValue(): string |
|
63 | - { |
|
64 | - return sprintf('%d', $this->value); |
|
65 | - } |
|
59 | + /** |
|
60 | + * {@inheritdoc} |
|
61 | + */ |
|
62 | + public function getFieldValue(): string |
|
63 | + { |
|
64 | + return sprintf('%d', $this->value); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Validates the given value |
|
69 | - * |
|
70 | - * @param int $value |
|
71 | - * |
|
72 | - * @return void |
|
73 | - * |
|
74 | - * @throws InvalidHeaderValueException |
|
75 | - * If the value isn't valid. |
|
76 | - */ |
|
77 | - private function validateValue(int $value): void |
|
78 | - { |
|
79 | - if (! ($value === -1 || $value >= 1)) { |
|
80 | - throw new InvalidHeaderValueException(sprintf( |
|
81 | - 'The value "%2$d" for the header "%1$s" is not valid.', |
|
82 | - $this->getFieldName(), |
|
83 | - $value |
|
84 | - )); |
|
85 | - } |
|
86 | - } |
|
67 | + /** |
|
68 | + * Validates the given value |
|
69 | + * |
|
70 | + * @param int $value |
|
71 | + * |
|
72 | + * @return void |
|
73 | + * |
|
74 | + * @throws InvalidHeaderValueException |
|
75 | + * If the value isn't valid. |
|
76 | + */ |
|
77 | + private function validateValue(int $value): void |
|
78 | + { |
|
79 | + if (! ($value === -1 || $value >= 1)) { |
|
80 | + throw new InvalidHeaderValueException(sprintf( |
|
81 | + 'The value "%2$d" for the header "%1$s" is not valid.', |
|
82 | + $this->getFieldName(), |
|
83 | + $value |
|
84 | + )); |
|
85 | + } |
|
86 | + } |
|
87 | 87 | } |
@@ -76,7 +76,7 @@ |
||
76 | 76 | */ |
77 | 77 | private function validateValue(int $value): void |
78 | 78 | { |
79 | - if (! ($value === -1 || $value >= 1)) { |
|
79 | + if (!($value === -1 || $value >= 1)) { |
|
80 | 80 | throw new InvalidHeaderValueException(sprintf( |
81 | 81 | 'The value "%2$d" for the header "%1$s" is not valid.', |
82 | 82 | $this->getFieldName(), |
@@ -28,60 +28,60 @@ |
||
28 | 28 | class ContentLengthHeader extends Header |
29 | 29 | { |
30 | 30 | |
31 | - /** |
|
32 | - * @var int |
|
33 | - */ |
|
34 | - private int $value; |
|
31 | + /** |
|
32 | + * @var int |
|
33 | + */ |
|
34 | + private int $value; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Constructor of the class |
|
38 | - * |
|
39 | - * @param int $value |
|
40 | - * |
|
41 | - * @throws InvalidHeaderValueException |
|
42 | - * If the value isn't valid. |
|
43 | - */ |
|
44 | - public function __construct(int $value) |
|
45 | - { |
|
46 | - $this->validateValue($value); |
|
36 | + /** |
|
37 | + * Constructor of the class |
|
38 | + * |
|
39 | + * @param int $value |
|
40 | + * |
|
41 | + * @throws InvalidHeaderValueException |
|
42 | + * If the value isn't valid. |
|
43 | + */ |
|
44 | + public function __construct(int $value) |
|
45 | + { |
|
46 | + $this->validateValue($value); |
|
47 | 47 | |
48 | - $this->value = $value; |
|
49 | - } |
|
48 | + $this->value = $value; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * {@inheritdoc} |
|
53 | - */ |
|
54 | - public function getFieldName(): string |
|
55 | - { |
|
56 | - return 'Content-Length'; |
|
57 | - } |
|
51 | + /** |
|
52 | + * {@inheritdoc} |
|
53 | + */ |
|
54 | + public function getFieldName(): string |
|
55 | + { |
|
56 | + return 'Content-Length'; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * {@inheritdoc} |
|
61 | - */ |
|
62 | - public function getFieldValue(): string |
|
63 | - { |
|
64 | - return sprintf('%d', $this->value); |
|
65 | - } |
|
59 | + /** |
|
60 | + * {@inheritdoc} |
|
61 | + */ |
|
62 | + public function getFieldValue(): string |
|
63 | + { |
|
64 | + return sprintf('%d', $this->value); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Validates the given value |
|
69 | - * |
|
70 | - * @param int $value |
|
71 | - * |
|
72 | - * @return void |
|
73 | - * |
|
74 | - * @throws InvalidHeaderValueException |
|
75 | - * If the value isn't valid. |
|
76 | - */ |
|
77 | - private function validateValue(int $value): void |
|
78 | - { |
|
79 | - if (! ($value >= 0)) { |
|
80 | - throw new InvalidHeaderValueException(sprintf( |
|
81 | - 'The value "%2$d" for the header "%1$s" is not valid', |
|
82 | - $this->getFieldName(), |
|
83 | - $value |
|
84 | - )); |
|
85 | - } |
|
86 | - } |
|
67 | + /** |
|
68 | + * Validates the given value |
|
69 | + * |
|
70 | + * @param int $value |
|
71 | + * |
|
72 | + * @return void |
|
73 | + * |
|
74 | + * @throws InvalidHeaderValueException |
|
75 | + * If the value isn't valid. |
|
76 | + */ |
|
77 | + private function validateValue(int $value): void |
|
78 | + { |
|
79 | + if (! ($value >= 0)) { |
|
80 | + throw new InvalidHeaderValueException(sprintf( |
|
81 | + 'The value "%2$d" for the header "%1$s" is not valid', |
|
82 | + $this->getFieldName(), |
|
83 | + $value |
|
84 | + )); |
|
85 | + } |
|
86 | + } |
|
87 | 87 | } |
@@ -76,7 +76,7 @@ |
||
76 | 76 | */ |
77 | 77 | private function validateValue(int $value): void |
78 | 78 | { |
79 | - if (! ($value >= 0)) { |
|
79 | + if (!($value >= 0)) { |
|
80 | 80 | throw new InvalidHeaderValueException(sprintf( |
81 | 81 | 'The value "%2$d" for the header "%1$s" is not valid', |
82 | 82 | $this->getFieldName(), |
@@ -25,39 +25,39 @@ |
||
25 | 25 | class LocationHeader extends Header |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * @var UriInterface |
|
30 | - */ |
|
31 | - private UriInterface $uri; |
|
32 | - |
|
33 | - /** |
|
34 | - * Constructor of the class |
|
35 | - * |
|
36 | - * @param mixed $uri |
|
37 | - * |
|
38 | - * @throws InvalidUriException |
|
39 | - * If the URI isn't valid. |
|
40 | - */ |
|
41 | - public function __construct($uri) |
|
42 | - { |
|
43 | - $uri = Uri::create($uri); |
|
44 | - |
|
45 | - $this->uri = $uri; |
|
46 | - } |
|
47 | - |
|
48 | - /** |
|
49 | - * {@inheritdoc} |
|
50 | - */ |
|
51 | - public function getFieldName(): string |
|
52 | - { |
|
53 | - return 'Location'; |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * {@inheritdoc} |
|
58 | - */ |
|
59 | - public function getFieldValue(): string |
|
60 | - { |
|
61 | - return $this->uri->__toString(); |
|
62 | - } |
|
28 | + /** |
|
29 | + * @var UriInterface |
|
30 | + */ |
|
31 | + private UriInterface $uri; |
|
32 | + |
|
33 | + /** |
|
34 | + * Constructor of the class |
|
35 | + * |
|
36 | + * @param mixed $uri |
|
37 | + * |
|
38 | + * @throws InvalidUriException |
|
39 | + * If the URI isn't valid. |
|
40 | + */ |
|
41 | + public function __construct($uri) |
|
42 | + { |
|
43 | + $uri = Uri::create($uri); |
|
44 | + |
|
45 | + $this->uri = $uri; |
|
46 | + } |
|
47 | + |
|
48 | + /** |
|
49 | + * {@inheritdoc} |
|
50 | + */ |
|
51 | + public function getFieldName(): string |
|
52 | + { |
|
53 | + return 'Location'; |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * {@inheritdoc} |
|
58 | + */ |
|
59 | + public function getFieldValue(): string |
|
60 | + { |
|
61 | + return $this->uri->__toString(); |
|
62 | + } |
|
63 | 63 | } |
@@ -29,44 +29,44 @@ |
||
29 | 29 | class AccessControlAllowMethodsHeader extends Header |
30 | 30 | { |
31 | 31 | |
32 | - /** |
|
33 | - * @var list<string> |
|
34 | - */ |
|
35 | - private array $methods = []; |
|
32 | + /** |
|
33 | + * @var list<string> |
|
34 | + */ |
|
35 | + private array $methods = []; |
|
36 | 36 | |
37 | - /** |
|
38 | - * Constructor of the class |
|
39 | - * |
|
40 | - * @param string ...$methods |
|
41 | - * |
|
42 | - * @throws InvalidHeaderValueException |
|
43 | - * If one of the methods isn't valid. |
|
44 | - */ |
|
45 | - public function __construct(string ...$methods) |
|
46 | - { |
|
47 | - /** @var list<string> $methods */ |
|
37 | + /** |
|
38 | + * Constructor of the class |
|
39 | + * |
|
40 | + * @param string ...$methods |
|
41 | + * |
|
42 | + * @throws InvalidHeaderValueException |
|
43 | + * If one of the methods isn't valid. |
|
44 | + */ |
|
45 | + public function __construct(string ...$methods) |
|
46 | + { |
|
47 | + /** @var list<string> $methods */ |
|
48 | 48 | |
49 | - $this->validateToken(...$methods); |
|
49 | + $this->validateToken(...$methods); |
|
50 | 50 | |
51 | - // normalize the list of methods... |
|
52 | - foreach ($methods as $method) { |
|
53 | - $this->methods[] = strtoupper($method); |
|
54 | - } |
|
55 | - } |
|
51 | + // normalize the list of methods... |
|
52 | + foreach ($methods as $method) { |
|
53 | + $this->methods[] = strtoupper($method); |
|
54 | + } |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * {@inheritdoc} |
|
59 | - */ |
|
60 | - public function getFieldName(): string |
|
61 | - { |
|
62 | - return 'Access-Control-Allow-Methods'; |
|
63 | - } |
|
57 | + /** |
|
58 | + * {@inheritdoc} |
|
59 | + */ |
|
60 | + public function getFieldName(): string |
|
61 | + { |
|
62 | + return 'Access-Control-Allow-Methods'; |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * {@inheritdoc} |
|
67 | - */ |
|
68 | - public function getFieldValue(): string |
|
69 | - { |
|
70 | - return implode(', ', $this->methods); |
|
71 | - } |
|
65 | + /** |
|
66 | + * {@inheritdoc} |
|
67 | + */ |
|
68 | + public function getFieldValue(): string |
|
69 | + { |
|
70 | + return implode(', ', $this->methods); |
|
71 | + } |
|
72 | 72 | } |
@@ -29,65 +29,65 @@ |
||
29 | 29 | class ContentTypeHeader extends Header |
30 | 30 | { |
31 | 31 | |
32 | - /** |
|
33 | - * Regular Expression for a content type validation |
|
34 | - * |
|
35 | - * @link https://tools.ietf.org/html/rfc6838#section-4.2 |
|
36 | - * |
|
37 | - * @var string |
|
38 | - */ |
|
39 | - public const RFC6838_CONTENT_TYPE = '/^[\dA-Za-z][\d\w\!#\$&\+\-\.\^]*(?:\/[\dA-Za-z][\d\w\!#\$&\+\-\.\^]*)?$/'; |
|
32 | + /** |
|
33 | + * Regular Expression for a content type validation |
|
34 | + * |
|
35 | + * @link https://tools.ietf.org/html/rfc6838#section-4.2 |
|
36 | + * |
|
37 | + * @var string |
|
38 | + */ |
|
39 | + public const RFC6838_CONTENT_TYPE = '/^[\dA-Za-z][\d\w\!#\$&\+\-\.\^]*(?:\/[\dA-Za-z][\d\w\!#\$&\+\-\.\^]*)?$/'; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @var string |
|
43 | - */ |
|
44 | - private string $type; |
|
41 | + /** |
|
42 | + * @var string |
|
43 | + */ |
|
44 | + private string $type; |
|
45 | 45 | |
46 | - /** |
|
47 | - * @var array<string, string> |
|
48 | - */ |
|
49 | - private array $parameters; |
|
46 | + /** |
|
47 | + * @var array<string, string> |
|
48 | + */ |
|
49 | + private array $parameters; |
|
50 | 50 | |
51 | - /** |
|
52 | - * Constructor of the class |
|
53 | - * |
|
54 | - * @param string $type |
|
55 | - * @param array<array-key, mixed> $parameters |
|
56 | - * |
|
57 | - * @throws InvalidHeaderValueException |
|
58 | - * If the type isn't valid. |
|
59 | - * |
|
60 | - * @throws InvalidHeaderValueParameterException |
|
61 | - * If the parameters aren't valid. |
|
62 | - */ |
|
63 | - public function __construct(string $type, array $parameters = []) |
|
64 | - { |
|
65 | - $this->validateValueByRegex(self::RFC6838_CONTENT_TYPE, $type); |
|
51 | + /** |
|
52 | + * Constructor of the class |
|
53 | + * |
|
54 | + * @param string $type |
|
55 | + * @param array<array-key, mixed> $parameters |
|
56 | + * |
|
57 | + * @throws InvalidHeaderValueException |
|
58 | + * If the type isn't valid. |
|
59 | + * |
|
60 | + * @throws InvalidHeaderValueParameterException |
|
61 | + * If the parameters aren't valid. |
|
62 | + */ |
|
63 | + public function __construct(string $type, array $parameters = []) |
|
64 | + { |
|
65 | + $this->validateValueByRegex(self::RFC6838_CONTENT_TYPE, $type); |
|
66 | 66 | |
67 | - $parameters = $this->validateParameters($parameters); |
|
67 | + $parameters = $this->validateParameters($parameters); |
|
68 | 68 | |
69 | - $this->type = $type; |
|
70 | - $this->parameters = $parameters; |
|
71 | - } |
|
69 | + $this->type = $type; |
|
70 | + $this->parameters = $parameters; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * {@inheritdoc} |
|
75 | - */ |
|
76 | - public function getFieldName(): string |
|
77 | - { |
|
78 | - return 'Content-Type'; |
|
79 | - } |
|
73 | + /** |
|
74 | + * {@inheritdoc} |
|
75 | + */ |
|
76 | + public function getFieldName(): string |
|
77 | + { |
|
78 | + return 'Content-Type'; |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * {@inheritdoc} |
|
83 | - */ |
|
84 | - public function getFieldValue(): string |
|
85 | - { |
|
86 | - $v = $this->type; |
|
87 | - foreach ($this->parameters as $name => $value) { |
|
88 | - $v .= sprintf('; %s="%s"', $name, $value); |
|
89 | - } |
|
81 | + /** |
|
82 | + * {@inheritdoc} |
|
83 | + */ |
|
84 | + public function getFieldValue(): string |
|
85 | + { |
|
86 | + $v = $this->type; |
|
87 | + foreach ($this->parameters as $name => $value) { |
|
88 | + $v .= sprintf('; %s="%s"', $name, $value); |
|
89 | + } |
|
90 | 90 | |
91 | - return $v; |
|
92 | - } |
|
91 | + return $v; |
|
92 | + } |
|
93 | 93 | } |