2
0

Interface.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 Router
  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. * @package Zend_Controller
  22. * @subpackage Router
  23. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  24. * @license http://framework.zend.com/license/new-bsd New BSD License
  25. */
  26. interface Zend_Controller_Router_Interface
  27. {
  28. /**
  29. * Processes a request and sets its controller and action. If
  30. * no route was possible, an exception is thrown.
  31. *
  32. * @param Zend_Controller_Request_Abstract
  33. * @throws Zend_Controller_Router_Exception
  34. * @return Zend_Controller_Request_Abstract|boolean
  35. */
  36. public function route(Zend_Controller_Request_Abstract $dispatcher);
  37. /**
  38. * Generates a URL path that can be used in URL creation, redirection, etc.
  39. *
  40. * May be passed user params to override ones from URI, Request or even defaults.
  41. * If passed parameter has a value of null, it's URL variable will be reset to
  42. * default.
  43. *
  44. * If null is passed as a route name assemble will use the current Route or 'default'
  45. * if current is not yet set.
  46. *
  47. * Reset is used to signal that all parameters should be reset to it's defaults.
  48. * Ignoring all URL specified values. User specified params still get precedence.
  49. *
  50. * Encode tells to url encode resulting path parts.
  51. *
  52. * @param array $userParams Options passed by a user used to override parameters
  53. * @param mixed $name The name of a Route to use
  54. * @param bool $reset Whether to reset to the route defaults ignoring URL params
  55. * @param bool $encode Tells to encode URL parts on output
  56. * @throws Zend_Controller_Router_Exception
  57. * @return string Resulting URL path
  58. */
  59. public function assemble($userParams, $name = null, $reset = false, $encode = true);
  60. /**
  61. * Retrieve Front Controller
  62. *
  63. * @return Zend_Controller_Front
  64. */
  65. public function getFrontController();
  66. /**
  67. * Set Front Controller
  68. *
  69. * @param Zend_Controller_Front $controller
  70. * @return Zend_Controller_Router_Interface
  71. */
  72. public function setFrontController(Zend_Controller_Front $controller);
  73. /**
  74. * Add or modify a parameter with which to instantiate any helper objects
  75. *
  76. * @param string $name
  77. * @param mixed $param
  78. * @return Zend_Controller_Router_Interface
  79. */
  80. public function setParam($name, $value);
  81. /**
  82. * Set an array of a parameters to pass to helper object constructors
  83. *
  84. * @param array $params
  85. * @return Zend_Controller_Router_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 helper object constructors
  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_Router_Interface
  110. */
  111. public function clearParams($name = null);
  112. }