1 | <?php |
||
21 | abstract class AbstractResponse |
||
22 | { |
||
23 | use HttpStatusTrait; |
||
24 | |||
25 | /** |
||
26 | * @var HeaderBag |
||
27 | */ |
||
28 | public $headers; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $content; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $version; |
||
39 | |||
40 | /** |
||
41 | * @var int |
||
42 | */ |
||
43 | protected $statusCode; |
||
44 | |||
45 | /** |
||
46 | * @var string |
||
47 | */ |
||
48 | protected $statusText; |
||
49 | |||
50 | /** |
||
51 | * @var string |
||
52 | */ |
||
53 | protected $charset = 'UTF-8'; |
||
54 | |||
55 | /** |
||
56 | * @var string |
||
57 | */ |
||
58 | protected $encoding; |
||
59 | |||
60 | /** |
||
61 | * @var string |
||
62 | */ |
||
63 | protected $contentType; |
||
64 | |||
65 | /** |
||
66 | * Set protocol version. |
||
67 | * |
||
68 | * @param string $version |
||
69 | * |
||
70 | * @return $this |
||
71 | */ |
||
72 | public function setProtocolVersion($version) |
||
78 | |||
79 | /** |
||
80 | * Get content. |
||
81 | * |
||
82 | * @return string |
||
83 | */ |
||
84 | public function getContent() |
||
88 | |||
89 | /** |
||
90 | * Set content. |
||
91 | * |
||
92 | * @param string $content |
||
93 | * |
||
94 | * @return $this |
||
95 | */ |
||
96 | public function setContent($content) |
||
109 | |||
110 | /** |
||
111 | * Get return protocol version. |
||
112 | * |
||
113 | * @return string |
||
114 | */ |
||
115 | public function getProtocolVersion() |
||
119 | |||
120 | /** |
||
121 | * Get charset. |
||
122 | * |
||
123 | * @return string |
||
124 | */ |
||
125 | public function getCharset() |
||
129 | |||
130 | /** |
||
131 | * Set charset. |
||
132 | * |
||
133 | * @param string $charset |
||
134 | * |
||
135 | * @return $this |
||
136 | */ |
||
137 | public function setCharset($charset) |
||
143 | |||
144 | /** |
||
145 | * Set content encoding. |
||
146 | * |
||
147 | * @param string $encoding |
||
148 | * |
||
149 | * @return $this |
||
150 | */ |
||
151 | public function setContentEncoding($encoding) |
||
158 | |||
159 | /** |
||
160 | * Get content encoding. |
||
161 | * |
||
162 | * @return string |
||
163 | */ |
||
164 | public function getContentEncoding() |
||
168 | |||
169 | /** |
||
170 | * Get content type. |
||
171 | * |
||
172 | * @return string |
||
173 | */ |
||
174 | public function getContentType() |
||
178 | |||
179 | /** |
||
180 | * Set content type. |
||
181 | * |
||
182 | * @param string $contentType |
||
183 | * |
||
184 | * @return $this |
||
185 | */ |
||
186 | public function setContentType($contentType) |
||
193 | |||
194 | /** |
||
195 | * Cast Response as string representation. |
||
196 | * |
||
197 | * @return string |
||
198 | */ |
||
199 | abstract public function __toString(); |
||
200 | |||
201 | } |
||
202 |