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