1 | <?php |
||
14 | abstract class HttpException extends BaseHttpException |
||
15 | { |
||
16 | /** |
||
17 | * An HTTP status code. |
||
18 | * |
||
19 | * @var int |
||
20 | */ |
||
21 | protected $status = 500; |
||
22 | |||
23 | /** |
||
24 | * An error code. |
||
25 | * |
||
26 | * @var string|null |
||
27 | */ |
||
28 | protected $errorCode = null; |
||
29 | |||
30 | /** |
||
31 | * An error message. |
||
32 | * |
||
33 | * @var string|null |
||
34 | */ |
||
35 | protected $message = null; |
||
36 | |||
37 | /** |
||
38 | * Additional error data. |
||
39 | * |
||
40 | * @var array|null |
||
41 | */ |
||
42 | protected $data = null; |
||
43 | |||
44 | /** |
||
45 | * Attached headers. |
||
46 | * |
||
47 | * @var array |
||
48 | */ |
||
49 | protected $headers = []; |
||
50 | |||
51 | /** |
||
52 | * Construct the exception class. |
||
53 | * |
||
54 | * @param string|null $message |
||
55 | * @param array|null $headers |
||
56 | */ |
||
57 | 10 | public function __construct(string $message = null, array $headers = null) |
|
61 | |||
62 | /** |
||
63 | * Retrieve the HTTP status code, |
||
64 | * |
||
65 | * @return int |
||
66 | */ |
||
67 | 1 | public function statusCode(): int |
|
71 | |||
72 | /** |
||
73 | * Retrieve the error code. |
||
74 | * |
||
75 | * @return string|null |
||
76 | */ |
||
77 | 1 | public function errorCode() |
|
81 | |||
82 | /** |
||
83 | * Retrieve the error message. |
||
84 | * |
||
85 | * @return string|null |
||
86 | */ |
||
87 | 1 | public function message() |
|
91 | |||
92 | /** |
||
93 | * Retrieve additional error data. |
||
94 | * |
||
95 | * @return array|null |
||
96 | */ |
||
97 | 1 | public function data() |
|
101 | |||
102 | /** |
||
103 | * Retrieve attached headers. |
||
104 | * |
||
105 | * @return array|null |
||
106 | */ |
||
107 | 1 | public function headers() |
|
111 | } |
||
112 |