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