File indexing completed on 2024-12-22 05:36:34

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Controller
0017  * @subpackage Router
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id$
0021  */
0022 
0023 /**
0024  * @package    Zend_Controller
0025  * @subpackage Router
0026  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0027  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0028  */
0029 interface Zend_Controller_Router_Interface
0030 {
0031     /**
0032      * Processes a request and sets its controller and action.  If
0033      * no route was possible, an exception is thrown.
0034      *
0035      * @param  Zend_Controller_Request_Abstract
0036      * @throws Zend_Controller_Router_Exception
0037      * @return Zend_Controller_Request_Abstract|boolean
0038      */
0039     public function route(Zend_Controller_Request_Abstract $dispatcher);
0040 
0041     /**
0042      * Generates a URL path that can be used in URL creation, redirection, etc.
0043      *
0044      * May be passed user params to override ones from URI, Request or even defaults.
0045      * If passed parameter has a value of null, it's URL variable will be reset to
0046      * default.
0047      *
0048      * If null is passed as a route name assemble will use the current Route or 'default'
0049      * if current is not yet set.
0050      *
0051      * Reset is used to signal that all parameters should be reset to it's defaults.
0052      * Ignoring all URL specified values. User specified params still get precedence.
0053      *
0054      * Encode tells to url encode resulting path parts.
0055      *
0056      * @param  array $userParams Options passed by a user used to override parameters
0057      * @param  mixed $name       The name of a Route to use
0058      * @param  bool  $reset      Whether to reset to the route defaults ignoring URL params
0059      * @param  bool  $encode     Tells to encode URL parts on output
0060      * @throws Zend_Controller_Router_Exception
0061      * @return string Resulting URL path
0062      */
0063     public function assemble($userParams, $name = null, $reset = false, $encode = true);
0064 
0065     /**
0066      * Retrieve Front Controller
0067      *
0068      * @return Zend_Controller_Front
0069      */
0070     public function getFrontController();
0071 
0072     /**
0073      * Set Front Controller
0074      *
0075      * @param Zend_Controller_Front $controller
0076      * @return Zend_Controller_Router_Interface
0077      */
0078     public function setFrontController(Zend_Controller_Front $controller);
0079 
0080     /**
0081      * Add or modify a parameter with which to instantiate any helper objects
0082      *
0083      * @param string $name
0084      * @param mixed  $value
0085      * @return Zend_Controller_Router_Interface
0086      */
0087     public function setParam($name, $value);
0088 
0089     /**
0090      * Set an array of a parameters to pass to helper object constructors
0091      *
0092      * @param array $params
0093      * @return Zend_Controller_Router_Interface
0094      */
0095     public function setParams(array $params);
0096 
0097     /**
0098      * Retrieve a single parameter from the controller parameter stack
0099      *
0100      * @param string $name
0101      * @return mixed
0102      */
0103     public function getParam($name);
0104 
0105     /**
0106      * Retrieve the parameters to pass to helper object constructors
0107      *
0108      * @return array
0109      */
0110     public function getParams();
0111 
0112     /**
0113      * Clear the controller parameter stack
0114      *
0115      * By default, clears all parameters. If a parameter name is given, clears
0116      * only that parameter; if an array of parameter names is provided, clears
0117      * each.
0118      *
0119      * @param null|string|array single key or array of keys for params to clear
0120      * @return Zend_Controller_Router_Interface
0121      */
0122     public function clearParams($name = null);
0123 }