Interface.php 4.0 KB

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