1 | <?php |
||
35 | abstract class Response extends AttributeHolder |
||
36 | { |
||
37 | /** |
||
38 | * @var Context An Context instance. |
||
39 | */ |
||
40 | protected $context = null; |
||
41 | |||
42 | /** |
||
43 | * @var mixed The content to send back to the client. |
||
44 | */ |
||
45 | protected $content = null; |
||
46 | |||
47 | /** |
||
48 | * @var OutputType The output type of this response. |
||
49 | */ |
||
50 | protected $outputType = null; |
||
51 | |||
52 | /** |
||
53 | * Pre-serialization callback. |
||
54 | * |
||
55 | * Will set the name of the context and exclude the instance from serializing. |
||
56 | * |
||
57 | * @author David Zülke <[email protected]> |
||
58 | * @since 0.11.0 |
||
59 | */ |
||
60 | public function __sleep() |
||
83 | |||
84 | /** |
||
85 | * Post-unserialization callback. |
||
86 | * |
||
87 | * Will restore the context based on the names set by __sleep. |
||
88 | * |
||
89 | * @author David Zülke <[email protected]> |
||
90 | * @since 0.11.0 |
||
91 | */ |
||
92 | public function __wakeup() |
||
108 | |||
109 | /** |
||
110 | * Retrieve the Context instance this Response object belongs to. |
||
111 | * |
||
112 | * @return Context An Context instance. |
||
113 | * |
||
114 | * @author David Zülke <[email protected]> |
||
115 | * @since 0.11.0 |
||
116 | */ |
||
117 | final public function getContext() |
||
121 | |||
122 | /** |
||
123 | * Initialize this Response. |
||
124 | * |
||
125 | * @param Context $context An Context instance. |
||
126 | * @param array $parameters An array of initialization parameters. |
||
127 | * |
||
128 | * @author David Zülke <[email protected]> |
||
129 | * @since 0.11.0 |
||
130 | */ |
||
131 | public function initialize(Context $context, array $parameters = array()) |
||
136 | |||
137 | /** |
||
138 | * Get the Output Type to use with this response. |
||
139 | * |
||
140 | * @return OutputType The Output Type instance associated with. |
||
141 | * |
||
142 | * @author David Zülke <[email protected]> |
||
143 | * @since 0.11.1 |
||
144 | */ |
||
145 | public function getOutputType() |
||
149 | |||
150 | /** |
||
151 | * Set the Output Type to use with this response. |
||
152 | * |
||
153 | * @param OutputType $outputType The Output Type instance to associate with. |
||
154 | * |
||
155 | * @author David Zülke <[email protected]> |
||
156 | * @since 0.11.1 |
||
157 | */ |
||
158 | public function setOutputType(OutputType $outputType) |
||
162 | |||
163 | /** |
||
164 | * Clear the Output Type to use with this response. |
||
165 | * |
||
166 | * @author David Zülke <[email protected]> |
||
167 | * @since 0.11.1 |
||
168 | */ |
||
169 | public function clearOutputType() |
||
173 | |||
174 | /** |
||
175 | * Retrieve the content set for this Response. |
||
176 | * |
||
177 | * @return mixed The content set in this Response. |
||
178 | * |
||
179 | * @author David Zülke <[email protected]> |
||
180 | * @since 0.11.0 |
||
181 | */ |
||
182 | public function getContent() |
||
186 | |||
187 | /** |
||
188 | * Check whether or not some content is set. |
||
189 | * |
||
190 | * @return bool If any content is set, false otherwise. |
||
191 | * |
||
192 | * @author David Zülke <[email protected]> |
||
193 | * @since 0.11.6 |
||
194 | */ |
||
195 | public function hasContent() |
||
199 | |||
200 | /** |
||
201 | * Retrieve the size (in bytes) of the content set for this Response. |
||
202 | * |
||
203 | * @return int The content size in bytes. |
||
204 | * |
||
205 | * @author David Zülke <[email protected]> |
||
206 | * @since 0.11.0 |
||
207 | */ |
||
208 | public function getContentSize() |
||
220 | |||
221 | /** |
||
222 | * Set the content for this Response. |
||
223 | * |
||
224 | * @param mixed $content The content to be sent in this Response. |
||
225 | * |
||
226 | * @author David Zülke <[email protected]> |
||
227 | * @since 0.11.0 |
||
228 | */ |
||
229 | public function setContent($content) |
||
233 | |||
234 | /** |
||
235 | * Prepend content to the existing content for this Response. |
||
236 | * |
||
237 | * @param mixed $content The content to be prepended to this Response. |
||
238 | * |
||
239 | * @author David Zülke <[email protected]> |
||
240 | * @since 0.11.0 |
||
241 | */ |
||
242 | public function prependContent($content) |
||
246 | |||
247 | /** |
||
248 | * Append content to the existing content for this Response. |
||
249 | * |
||
250 | * @param mixed $content The content to be appended to this Response. |
||
251 | * |
||
252 | * @author David Zülke <[email protected]> |
||
253 | * @since 0.11.0 |
||
254 | */ |
||
255 | public function appendContent($content) |
||
259 | |||
260 | /** |
||
261 | * Clear the content for this Response |
||
262 | * |
||
263 | * @author David Zülke <[email protected]> |
||
264 | * @since 0.11.0 |
||
265 | */ |
||
266 | public function clearContent() |
||
270 | |||
271 | /** |
||
272 | * Redirect externally. |
||
273 | * |
||
274 | * @param mixed $to Where to redirect. |
||
275 | * |
||
276 | * @author David Zülke <[email protected]> |
||
277 | * @since 0.11.0 |
||
278 | */ |
||
279 | abstract public function setRedirect($to); |
||
280 | |||
281 | /** |
||
282 | * Get info about the set redirect. |
||
283 | * |
||
284 | * @return array An assoc array of redirect info, or null if none set. |
||
285 | * |
||
286 | * @author David Zülke <[email protected]> |
||
287 | * @since 0.11.0 |
||
288 | */ |
||
289 | abstract public function getRedirect(); |
||
290 | |||
291 | /** |
||
292 | * Check if a redirect is set. |
||
293 | * |
||
294 | * @return bool true, if a redirect is set, otherwise false |
||
295 | * |
||
296 | * @author David Zülke <[email protected]> |
||
297 | * @since 0.11.0 |
||
298 | */ |
||
299 | abstract public function hasRedirect(); |
||
300 | |||
301 | /** |
||
302 | * Clear any set redirect information. |
||
303 | * |
||
304 | * @author David Zülke <[email protected]> |
||
305 | * @since 0.11.0 |
||
306 | */ |
||
307 | abstract public function clearRedirect(); |
||
308 | |||
309 | /** |
||
310 | * Import response metadata from another response. |
||
311 | * |
||
312 | * @param Response $otherResponse The other response to import information from. |
||
313 | * |
||
314 | * @author David Zülke <[email protected]> |
||
315 | * @since 0.11.0 |
||
316 | */ |
||
317 | public function merge(Response $otherResponse) |
||
332 | |||
333 | /** |
||
334 | * Clear all data for this Response. |
||
335 | * |
||
336 | * @author David Zülke <[email protected]> |
||
337 | * @since 0.11.0 |
||
338 | */ |
||
339 | abstract public function clear(); |
||
340 | |||
341 | /** |
||
342 | * Send all response data to the client. |
||
343 | * |
||
344 | * @param OutputType $outputType An optional Output Type object with information |
||
345 | * the response can use to send additional data. |
||
346 | * |
||
347 | * @author David Zülke <[email protected]> |
||
348 | * @since 0.11.0 |
||
349 | */ |
||
350 | abstract public function send(OutputType $outputType = null); |
||
351 | |||
352 | /** |
||
353 | * Determine whether the content in the response may be modified by appending |
||
354 | * or prepending data using string operations. Typically false for streams, |
||
355 | * and for responses like XMLRPC where the content is an array. |
||
356 | * |
||
357 | * @return bool If the content can be treated as / changed like a string. |
||
358 | * |
||
359 | * @author David Zülke <[email protected]> |
||
360 | * @since 0.11.0 |
||
361 | */ |
||
362 | public function isContentMutable() |
||
366 | |||
367 | /** |
||
368 | * Send the content for this response |
||
369 | * |
||
370 | * @author David Zülke <[email protected]> |
||
371 | * @since 0.11.0 |
||
372 | */ |
||
373 | protected function sendContent() |
||
382 | } |
||
383 |
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.
If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.