Total Complexity | 8 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
5 | class Response |
||
6 | { |
||
7 | public function __construct( |
||
8 | private readonly array $headers, |
||
9 | private readonly string $requestedUrl, |
||
10 | private readonly ?int $statusCode, |
||
11 | private readonly array|string $body, |
||
12 | ) { |
||
13 | } |
||
14 | |||
15 | public function getHeader(string $name, $default = null): mixed |
||
16 | { |
||
17 | return $this->headers[$name] ?? $default; |
||
18 | } |
||
19 | |||
20 | public function getHeaders(): array |
||
23 | } |
||
24 | |||
25 | public function hasHeader(string $name): bool |
||
26 | { |
||
27 | return isset($this->headers[$name]); |
||
28 | } |
||
29 | |||
30 | public function getBody(): array|string |
||
33 | } |
||
34 | |||
35 | public function getRequestedUrl(): string |
||
36 | { |
||
37 | return $this->requestedUrl; |
||
38 | } |
||
39 | |||
40 | public function hasBody(): bool |
||
43 | } |
||
44 | |||
45 | public function getHttpResponseCode(): ?int |
||
48 | } |
||
49 | } |
||
50 |