| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Jose\Component\Checker; |
| 6 | |
| 7 | use Exception; |
| 8 | |
| 9 | /** |
| 10 | * This exception is thrown by header parameter checkers when a header parameter check failed. |
| 11 | */ |
| 12 | class InvalidHeaderException extends Exception |
| 13 | { |
| 14 | public function __construct( |
| 15 | string $message, |
| 16 | private readonly string $header, |
| 17 | private readonly mixed $value |
| 18 | ) { |
| 19 | parent::__construct($message); |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * Returns the header parameter that caused the exception. |
| 24 | */ |
| 25 | public function getHeader(): string |
| 26 | { |
| 27 | return $this->header; |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Returns the header parameter value that caused the exception. |
| 32 | */ |
| 33 | public function getValue(): mixed |
| 34 | { |
| 35 | return $this->value; |
| 36 | } |
| 37 | } |