Final Class Yiisoft\ErrorHandler\HeadersProvider
| Inheritance | Yiisoft\ErrorHandler\HeadersProvider |
|---|
HeadersProvider provides headers for error response.
It is used by {@see \Yiisoft\ErrorHandler\Middleware\ErrorCatcher} to add headers to response in case of error.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ErrorHandler\HeadersProvider | |
| add() | Adds a header to the list of headers. | Yiisoft\ErrorHandler\HeadersProvider |
| getAll() | Returns all headers. | Yiisoft\ErrorHandler\HeadersProvider |
Method Details
| public mixed __construct ( array | ||
| $headers | array |
Default headers list. |
public function __construct(
private array $headers = [],
) {}
Adds a header to the list of headers.
| public void add ( string $name, string|string[] $values ) | ||
| $name | string |
The header name. |
| $values | string|string[] |
The header value. |
public function add(string $name, string|array $values): void
{
$this->headers[$name] = (array) $values;
}
Returns all headers.
| public array | ||
| return | array |
The headers list. |
|---|---|---|
public function getAll(): array
{
return $this->headers;
}
Signup or Login in order to comment.