| Total Complexity | 3 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | final class HeadersProvider |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @param array<string, string[]> $headers Default headers list. |
||
| 17 | */ |
||
| 18 | 13 | public function __construct( |
|
| 19 | private array $headers = [], |
||
| 20 | ) { |
||
| 21 | 13 | } |
|
| 22 | |||
| 23 | /** |
||
| 24 | * Adds a header to the list of headers. |
||
| 25 | * |
||
| 26 | * @param string $name The header name. |
||
| 27 | * @param string|string[] $values The header value. |
||
| 28 | */ |
||
| 29 | 1 | public function add(string $name, string|array $values): void |
|
| 30 | { |
||
| 31 | 1 | $this->headers[$name] = (array)$values; |
|
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Returns all headers. |
||
| 36 | * |
||
| 37 | * @return array<string, string[]> The headers list. |
||
| 38 | */ |
||
| 39 | 10 | public function getAll(): array |
|
| 42 | } |
||
| 43 | } |
||
| 44 |