25761e585ac8c33a33e1292e6d51f92471402af1
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / MVC / RequestInterface.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
6 * All rights reserved
7 *
8 * This class is a backport of the corresponding class of FLOW3.
9 * All credits go to the v5 team.
10 *
11 * This script is part of the TYPO3 project. The TYPO3 project is
12 * free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * The GNU General Public License can be found at
18 * http://www.gnu.org/copyleft/gpl.html.
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27
28 /**
29 * Contract for a request.
30 *
31 * @version $Id: RequestInterface.php 1729 2009-11-25 21:37:20Z stucki $
32 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
33 * @author Robert Lemke <robert@typo3.org>
34 * @scope prototype
35 * @api
36 */
37 interface Tx_Extbase_MVC_RequestInterface {
38
39 /**
40 * Sets the dispatched flag
41 *
42 * @param boolean $flag If this request has been dispatched
43 * @return void
44 * @api
45 */
46 public function setDispatched($flag);
47
48 /**
49 * If this request has been dispatched and addressed by the responsible
50 * controller and the response is ready to be sent.
51 *
52 * The dispatcher will try to dispatch the request again if it has not been
53 * addressed yet.
54 *
55 * @return boolean TRUE if this request has been disptached successfully
56 * @api
57 */
58 public function isDispatched();
59
60 /**
61 * Returns the object name of the controller defined by the package key and
62 * controller name
63 *
64 * @return string The controller's Object Name
65 * @throws Tx_Extbase_MVC_Exception_NoSuchController if the controller does not exist
66 * @api
67 */
68 public function getControllerObjectName();
69
70 /**
71 * Sets the extension name of the controller.
72 *
73 * @param string $extensionName The extension name.
74 * @return void
75 * @throws Tx_Extbase_MVC_Exception_InvalidPackageKey if the package key is not valid
76 * @api
77 */
78 public function setControllerExtensionName($extensionName);
79
80 /**
81 * Returns the extension name of the specified controller.
82 *
83 * @return string The package key
84 * @api
85 */
86 public function getControllerExtensionName();
87
88 /**
89 * Sets the name of the controller which is supposed to handle the request.
90 * Note: This is not the object name of the controller!
91 *
92 * @param string $controllerName Name of the controller
93 * @return void
94 * @api
95 */
96 public function setControllerName($controllerName);
97
98 /**
99 * Returns the object name of the controller supposed to handle this request, if one
100 * was set already (if not, the name of the default controller is returned)
101 *
102 * @return string Object name of the controller
103 * @api
104 */
105 public function getControllerName();
106
107 /**
108 * Sets the name of the action contained in this request.
109 *
110 * Note that the action name must start with a lower case letter.
111 *
112 * @param string $actionName: Name of the action to execute by the controller
113 * @return void
114 * @throws Tx_Extbase_MVC_Exception_InvalidActionName if the action name is not valid
115 * @api
116 */
117 public function setControllerActionName($actionName);
118
119 /**
120 * Returns the name of the action the controller is supposed to execute.
121 *
122 * @return string Action name
123 * @author Robert Lemke <robert@typo3.org>
124 * @api
125 */
126 public function getControllerActionName();
127
128 /**
129 * Sets the value of the specified argument
130 *
131 * @param string $argumentName Name of the argument to set
132 * @param mixed $value The new value
133 * @return void
134 * @api
135 */
136 public function setArgument($argumentName, $value);
137
138 /**
139 * Sets the whole arguments array and therefore replaces any arguments
140 * which existed before.
141 *
142 * @param array $arguments An array of argument names and their values
143 * @return void
144 * @api
145 */
146 public function setArguments(array $arguments);
147
148 /**
149 * Returns the value of the specified argument
150 *
151 * @param string $argumentName Name of the argument
152 * @return string Value of the argument
153 * @throws Tx_Extbase_MVC_Exception_NoSuchArgument if such an argument does not exist
154 * @api
155 */
156 public function getArgument($argumentName);
157
158 /**
159 * Checks if an argument of the given name exists (is set)
160 *
161 * @param string $argumentName Name of the argument to check
162 * @return boolean TRUE if the argument is set, otherwise FALSE
163 * @api
164 */
165 public function hasArgument($argumentName);
166
167 /**
168 * Returns an array of arguments and their values
169 *
170 * @return array Array of arguments and their values (which may be arguments and values as well)
171 * @api
172 */
173 public function getArguments();
174
175 /**
176 * Sets the requested representation format
177 *
178 * @param string $format The desired format, something like "html", "xml", "png", "json" or the like.
179 * @return void
180 * @api
181 */
182 public function setFormat($format);
183
184 /**
185 * Returns the requested representation format
186 *
187 * @return string The desired format, something like "html", "xml", "png", "json" or the like.
188 * @api
189 */
190 public function getFormat();
191
192 /**
193 * Set the request errors that occured during the request
194 *
195 * @param array $errors An array of Tx_Extbase_Error_Error objects
196 * @return void
197 * @api
198 */
199 public function setErrors(array $errors);
200
201 /**
202 * Get the request errors that occured during the request
203 *
204 * @return array An array of Tx_Extbase_Error_Error objects
205 * @api
206 */
207 public function getErrors();
208
209 }
210 ?>