Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
OlzErrorPage | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
42 | |
0.00% |
0 / 1 |
getHtml | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
42 |
1 | <?php |
2 | |
3 | namespace Olz\Components\Error\OlzErrorPage; |
4 | |
5 | use Olz\Components\Common\OlzComponent; |
6 | use Olz\Components\Error\Olz400BadRequest\Olz400BadRequest; |
7 | use Olz\Components\Error\Olz401Unauthorized\Olz401Unauthorized; |
8 | use Olz\Components\Error\Olz403Forbidden\Olz403Forbidden; |
9 | use Olz\Components\Error\Olz404NotFound\Olz404NotFound; |
10 | use Olz\Components\Error\Olz500ServerInternalError\Olz500ServerInternalError; |
11 | use Olz\Components\Error\OlzOtherError\OlzOtherError; |
12 | |
13 | /** @extends OlzComponent<array<string, mixed>> */ |
14 | class OlzErrorPage extends OlzComponent { |
15 | public function getHtml(mixed $args): string { |
16 | $http_status_code = $args['http_status_code'] ?? 500; |
17 | if ($http_status_code === 400) { |
18 | return Olz400BadRequest::render([], $this); |
19 | } |
20 | if ($http_status_code === 401) { |
21 | return Olz401Unauthorized::render([], $this); |
22 | } |
23 | if ($http_status_code === 403) { |
24 | return Olz403Forbidden::render([], $this); |
25 | } |
26 | if ($http_status_code === 404) { |
27 | return Olz404NotFound::render([], $this); |
28 | } |
29 | if ($http_status_code === 500) { |
30 | return Olz500ServerInternalError::render([], $this); |
31 | } |
32 | return OlzOtherError::render([ |
33 | 'http_status_code' => $http_status_code, |
34 | ], $this); |
35 | } |
36 | } |