1 | <?php |
||
6 | trait HttpAttributesContainer |
||
7 | { |
||
8 | /** |
||
9 | * Status code |
||
10 | * |
||
11 | * @var int |
||
12 | */ |
||
13 | protected $statusCode = 200; |
||
14 | |||
15 | /** |
||
16 | * Response headers |
||
17 | * |
||
18 | * @var array |
||
19 | */ |
||
20 | protected $headers = []; |
||
21 | |||
22 | /** |
||
23 | * Set status code |
||
24 | * |
||
25 | * @param int $code |
||
26 | * @return mixed |
||
27 | */ |
||
28 | 1 | public function setStatusCode(int $code) |
|
32 | |||
33 | /** |
||
34 | * Get status code |
||
35 | * |
||
36 | * @return int |
||
37 | */ |
||
38 | 4 | public function getStatusCode(): int |
|
42 | |||
43 | /** |
||
44 | * Set header |
||
45 | * |
||
46 | * @param string $name |
||
47 | * @param string $value |
||
48 | * @return mixed |
||
49 | */ |
||
50 | 1 | public function setHeader(string $name, string $value) |
|
54 | |||
55 | /** |
||
56 | * Set headers |
||
57 | * |
||
58 | * @param array $headers |
||
59 | */ |
||
60 | 1 | public function setHeaders(array $headers) |
|
67 | |||
68 | /** |
||
69 | * Has header ? |
||
70 | * |
||
71 | * @param string $name |
||
72 | * @return bool |
||
73 | */ |
||
74 | 1 | public function hasHeader(string $name): bool |
|
78 | |||
79 | /** |
||
80 | * Get response headers |
||
81 | * |
||
82 | * @return array |
||
83 | */ |
||
84 | 6 | public function getHeaders(): array |
|
88 | } |