Response.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2015 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
11 namespace wcmf\lib\presentation;
12 
13 /**
14  * Response holds the response values that are used as output from
15  * Controller instances. It is typically instantiated by the ActionMapper
16  * instance and filled during Controller execution.
17  *
18  * @author ingo herwig <ingo@wemove.com>
19  */
20 interface Response extends ControllerMessage {
21 
22  const STATUS_200 = '200 OK';
23  const STATUS_201 = '201 Created';
24  const STATUS_202 = '202 Accepted';
25  const STATUS_204 = '204 No Content';
26 
27  const STATUS_400 = '400 Bad Request';
28  const STATUS_404 = '404 Not Found';
29 
30  /**
31  * Set a string value that uniquely identifies the request data
32  * that cause the current response. This value maybe used to compare
33  * two requests and return cached responses based on the result.
34  * @param $cacheId
35  */
36  public function setCacheId($cacheId);
37 
38  /**
39  * Get the cache id.
40  * @see Response::setCacheId()
41  * @return The id
42  */
43  public function getCacheId();
44 
45  /**
46  * Set the response HTTP status code
47  * @param $status The HTTP status code
48  */
49  public function setStatus($status);
50 
51  /**
52  * Get the response HTTP status code
53  * @return String
54  */
55  public function getStatus();
56 
57  /**
58  * Set a file download.
59  * NOTE: This automatically sets the response to final (see Response::setFinal)
60  * @param $filename The name of the file, must be a real file, if no content is provided
61  * @param $content File content, if in-memory only (optional)
62  */
63  public function setFile($filename, $content='');
64 
65  /**
66  * Get the file download
67  * @return Array with keys 'filename' and 'content' or null
68  */
69  public function getFile();
70 
71  /**
72  * Make sure there is no further processing after this response
73  */
74  public function setFinal();
75 
76  /**
77  * Check if the response forbids further processing or not
78  * @return Boolean
79  */
80  public function isFinal();
81 }
82 ?>
Response holds the response values that are used as output from Controller instances.
Definition: Response.php:20
setFile($filename, $content='')
Set a file download.
isFinal()
Check if the response forbids further processing or not.
getCacheId()
Get the cache id.
setStatus($status)
Set the response HTTP status code.
Presentation related interfaces and classes.
Definition: namespaces.php:59
setCacheId($cacheId)
Set a string value that uniquely identifies the request data that cause the current response...
Messages are sent between Controllers and are used to transfer data between them. ...
getStatus()
Get the response HTTP status code.
getFile()
Get the file download.
setFinal()
Make sure there is no further processing after this response.