|
19 | 19 | class HeaderAccessControlAllowHeaders extends AbstractHeader implements HeaderInterface |
20 | 20 | { |
21 | 21 |
|
22 | | - /** |
23 | | - * The header value |
24 | | - * |
25 | | - * @var array |
26 | | - */ |
27 | | - protected $value = []; |
| 22 | + /** |
| 23 | + * The header value |
| 24 | + * |
| 25 | + * @var array |
| 26 | + */ |
| 27 | + protected $value = []; |
28 | 28 |
|
29 | | - /** |
30 | | - * Constructor of the class |
31 | | - * |
32 | | - * @param string ...$value |
33 | | - */ |
34 | | - public function __construct(string ...$value) |
35 | | - { |
36 | | - $this->setValue(...$value); |
37 | | - } |
| 29 | + /** |
| 30 | + * Constructor of the class |
| 31 | + * |
| 32 | + * @param string ...$value |
| 33 | + */ |
| 34 | + public function __construct(string ...$value) |
| 35 | + { |
| 36 | + $this->setValue(...$value); |
| 37 | + } |
38 | 38 |
|
39 | | - /** |
40 | | - * Sets the header value |
41 | | - * |
42 | | - * @param string ...$value |
43 | | - * |
44 | | - * @return self |
45 | | - * |
46 | | - * @throws \InvalidArgumentException |
47 | | - */ |
48 | | - public function setValue(string ...$value) : self |
49 | | - { |
50 | | - foreach ($value as $oneOf) |
51 | | - { |
52 | | - if (! \preg_match(HeaderInterface::RFC7230_TOKEN, $oneOf)) |
53 | | - { |
54 | | - throw new \InvalidArgumentException(\sprintf('The value "%s" for the header "%s" is not valid', $oneOf, $this->getFieldName())); |
55 | | - } |
| 39 | + /** |
| 40 | + * Sets the header value |
| 41 | + * |
| 42 | + * @param string ...$value |
| 43 | + * |
| 44 | + * @return self |
| 45 | + * |
| 46 | + * @throws \InvalidArgumentException |
| 47 | + */ |
| 48 | + public function setValue(string ...$value) : self |
| 49 | + { |
| 50 | + foreach ($value as $oneOf) { |
| 51 | + if (! \preg_match(HeaderInterface::RFC7230_TOKEN, $oneOf)) { |
| 52 | + throw new \InvalidArgumentException( |
| 53 | + \sprintf('The value "%s" for the header "%s" is not valid', $oneOf, $this->getFieldName()) |
| 54 | + ); |
| 55 | + } |
56 | 56 |
|
57 | | - $this->value[$oneOf] = true; |
58 | | - } |
| 57 | + $this->value[$oneOf] = true; |
| 58 | + } |
59 | 59 |
|
60 | | - return $this; |
61 | | - } |
| 60 | + return $this; |
| 61 | + } |
62 | 62 |
|
63 | | - /** |
64 | | - * Gets the header value |
65 | | - * |
66 | | - * @return array |
67 | | - */ |
68 | | - public function getValue() : array |
69 | | - { |
70 | | - return \array_keys($this->value); |
71 | | - } |
| 63 | + /** |
| 64 | + * Gets the header value |
| 65 | + * |
| 66 | + * @return array |
| 67 | + */ |
| 68 | + public function getValue() : array |
| 69 | + { |
| 70 | + return \array_keys($this->value); |
| 71 | + } |
72 | 72 |
|
73 | | - /** |
74 | | - * Resets the header value |
75 | | - * |
76 | | - * @return self |
77 | | - */ |
78 | | - public function resetValue() : self |
79 | | - { |
80 | | - $this->value = []; |
| 73 | + /** |
| 74 | + * Resets the header value |
| 75 | + * |
| 76 | + * @return self |
| 77 | + */ |
| 78 | + public function resetValue() : self |
| 79 | + { |
| 80 | + $this->value = []; |
81 | 81 |
|
82 | | - return $this; |
83 | | - } |
| 82 | + return $this; |
| 83 | + } |
84 | 84 |
|
85 | | - /** |
86 | | - * {@inheritDoc} |
87 | | - */ |
88 | | - public function getFieldName() : string |
89 | | - { |
90 | | - return 'Access-Control-Allow-Headers'; |
91 | | - } |
| 85 | + /** |
| 86 | + * {@inheritDoc} |
| 87 | + */ |
| 88 | + public function getFieldName() : string |
| 89 | + { |
| 90 | + return 'Access-Control-Allow-Headers'; |
| 91 | + } |
92 | 92 |
|
93 | | - /** |
94 | | - * {@inheritDoc} |
95 | | - */ |
96 | | - public function getFieldValue() : string |
97 | | - { |
98 | | - return \implode(', ', $this->getValue()); |
99 | | - } |
| 93 | + /** |
| 94 | + * {@inheritDoc} |
| 95 | + */ |
| 96 | + public function getFieldValue() : string |
| 97 | + { |
| 98 | + return \implode(', ', $this->getValue()); |
| 99 | + } |
100 | 100 | } |
0 commit comments