Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
HttpException | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getHeaders | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getStatusCode | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Engelsystem\Http\Exceptions; |
6 | |
7 | use RuntimeException; |
8 | use Throwable; |
9 | |
10 | class HttpException extends RuntimeException |
11 | { |
12 | /** |
13 | * @param Throwable|null $previous |
14 | */ |
15 | public function __construct( |
16 | protected int $statusCode, |
17 | string $message = '', |
18 | protected array $headers = [], |
19 | int $code = 0, |
20 | Throwable $previous = null |
21 | ) { |
22 | |
23 | parent::__construct($message, $code, $previous); |
24 | } |
25 | |
26 | public function getHeaders(): array |
27 | { |
28 | return $this->headers; |
29 | } |
30 | |
31 | public function getStatusCode(): int |
32 | { |
33 | return $this->statusCode; |
34 | } |
35 | } |