1 | <?php |
||
16 | class Response |
||
17 | { |
||
18 | |||
19 | /** |
||
20 | * Response code. |
||
21 | * |
||
22 | * @var int |
||
23 | */ |
||
24 | private $code; |
||
25 | |||
26 | /** |
||
27 | * Response headers. |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | private $headers; |
||
32 | |||
33 | /** |
||
34 | * Response body. |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | private $body; |
||
39 | |||
40 | /** |
||
41 | * Initialize response. |
||
42 | * |
||
43 | * @param int $code Response code. |
||
44 | * @param array $headers Response headers. |
||
45 | * @param string $body Response body. |
||
46 | */ |
||
47 | public function __construct($code = 0, $headers = [], $body = '') |
||
53 | |||
54 | /** |
||
55 | * Set code. |
||
56 | * |
||
57 | * @param int $code Response code. |
||
58 | */ |
||
59 | public function setCode($code) |
||
63 | |||
64 | /** |
||
65 | * Set headers. |
||
66 | * |
||
67 | * @param array $headers Response headers. |
||
68 | */ |
||
69 | public function setHeaders($headers) |
||
73 | |||
74 | /** |
||
75 | * Set body. |
||
76 | * |
||
77 | * @param string $body Response body. |
||
78 | */ |
||
79 | public function setBody($body) |
||
83 | |||
84 | /** |
||
85 | * Get code. |
||
86 | * |
||
87 | * @return int |
||
88 | */ |
||
89 | public function getCode() |
||
93 | |||
94 | /** |
||
95 | * Get headers. |
||
96 | * |
||
97 | * @return array $headers Response headers. |
||
98 | */ |
||
99 | public function getHeaders() |
||
103 | |||
104 | /** |
||
105 | * Get body. |
||
106 | * |
||
107 | * @return string $body Response body. |
||
108 | */ |
||
109 | public function getBody() |
||
113 | } |
||
114 |