Interface.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @package Zend_Controller
  16. * @subpackage Dispatcher
  17. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. */
  20. /**
  21. * Zend_Controller_Request_Abstract
  22. */
  23. require_once 'Zend/Controller/Request/Abstract.php';
  24. /**
  25. * Zend_Controller_Response_Abstract
  26. */
  27. require_once 'Zend/Controller/Response/Abstract.php';
  28. /**
  29. * @package Zend_Controller
  30. * @subpackage Dispatcher
  31. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  32. * @license http://framework.zend.com/license/new-bsd New BSD License
  33. */
  34. interface Zend_Controller_Dispatcher_Interface
  35. {
  36. /**
  37. * Formats a string into a controller name. This is used to take a raw
  38. * controller name, such as one that would be packaged inside a request
  39. * object, and reformat it to a proper class name that a class extending
  40. * Zend_Controller_Action would use.
  41. *
  42. * @param string $unformatted
  43. * @return string
  44. */
  45. public function formatControllerName($unformatted);
  46. /**
  47. * Formats a string into a module name. This is used to take a raw
  48. * module name, such as one that would be packaged inside a request
  49. * object, and reformat it to a proper directory/class name that a class extending
  50. * Zend_Controller_Action would use.
  51. *
  52. * @param string $unformatted
  53. * @return string
  54. */
  55. public function formatModuleName($unformatted);
  56. /**
  57. * Formats a string into an action name. This is used to take a raw
  58. * action name, such as one that would be packaged inside a request
  59. * object, and reformat into a proper method name that would be found
  60. * inside a class extending Zend_Controller_Action.
  61. *
  62. * @param string $unformatted
  63. * @return string
  64. */
  65. public function formatActionName($unformatted);
  66. /**
  67. * Returns TRUE if an action can be dispatched, or FALSE otherwise.
  68. *
  69. * @param Zend_Controller_Request_Abstract $request
  70. * @return boolean
  71. */
  72. public function isDispatchable(Zend_Controller_Request_Abstract $request);
  73. /**
  74. * Add or modify a parameter with which to instantiate an Action Controller
  75. *
  76. * @param string $name
  77. * @param mixed $value
  78. * @return Zend_Controller_Dispatcher_Interface
  79. */
  80. public function setParam($name, $value);
  81. /**
  82. * Set an array of a parameters to pass to the Action Controller constructor
  83. *
  84. * @param array $params
  85. * @return Zend_Controller_Dispatcher_Interface
  86. */
  87. public function setParams(array $params);
  88. /**
  89. * Retrieve a single parameter from the controller parameter stack
  90. *
  91. * @param string $name
  92. * @return mixed
  93. */
  94. public function getParam($name);
  95. /**
  96. * Retrieve the parameters to pass to the Action Controller constructor
  97. *
  98. * @return array
  99. */
  100. public function getParams();
  101. /**
  102. * Clear the controller parameter stack
  103. *
  104. * By default, clears all parameters. If a parameter name is given, clears
  105. * only that parameter; if an array of parameter names is provided, clears
  106. * each.
  107. *
  108. * @param null|string|array single key or array of keys for params to clear
  109. * @return Zend_Controller_Dispatcher_Interface
  110. */
  111. public function clearParams($name = null);
  112. /**
  113. * Set the response object to use, if any
  114. *
  115. * @param Zend_Controller_Response_Abstract|null $response
  116. * @return void
  117. */
  118. public function setResponse(Zend_Controller_Response_Abstract $response = null);
  119. /**
  120. * Retrieve the response object, if any
  121. *
  122. * @return Zend_Controller_Response_Abstract|null
  123. */
  124. public function getResponse();
  125. /**
  126. * Add a controller directory to the controller directory stack
  127. *
  128. * @param string $path
  129. * @param string $args
  130. * @return Zend_Controller_Dispatcher_Interface
  131. */
  132. public function addControllerDirectory($path, $args = null);
  133. /**
  134. * Set the directory where controller files are stored
  135. *
  136. * Specify a string or an array; if an array is specified, all paths will be
  137. * added.
  138. *
  139. * @param string|array $dir
  140. * @return Zend_Controller_Dispatcher_Interface
  141. */
  142. public function setControllerDirectory($path);
  143. /**
  144. * Return the currently set directory(ies) for controller file lookup
  145. *
  146. * @return array
  147. */
  148. public function getControllerDirectory();
  149. /**
  150. * Dispatches a request object to a controller/action. If the action
  151. * requests a forward to another action, a new request will be returned.
  152. *
  153. * @param Zend_Controller_Request_Abstract $request
  154. * @param Zend_Controller_Response_Abstract $response
  155. * @return void
  156. */
  157. public function dispatch(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response);
  158. /**
  159. * Whether or not a given module is valid
  160. *
  161. * @param string $module
  162. * @return boolean
  163. */
  164. public function isValidModule($module);
  165. /**
  166. * Retrieve the default module name
  167. *
  168. * @return string
  169. */
  170. public function getDefaultModule();
  171. /**
  172. * Retrieve the default controller name
  173. *
  174. * @return string
  175. */
  176. public function getDefaultControllerName();
  177. /**
  178. * Retrieve the default action
  179. *
  180. * @return string
  181. */
  182. public function getDefaultAction();
  183. }