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

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 Dispatcher
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  * Zend_Controller_Request_Abstract
0025  */
0026 // require_once 'Zend/Controller/Request/Abstract.php';
0027 
0028 /**
0029  * Zend_Controller_Response_Abstract
0030  */
0031 // require_once 'Zend/Controller/Response/Abstract.php';
0032 
0033 /**
0034  * @package    Zend_Controller
0035  * @subpackage Dispatcher
0036  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0037  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0038  */
0039 interface Zend_Controller_Dispatcher_Interface
0040 {
0041     /**
0042      * Formats a string into a controller name.  This is used to take a raw
0043      * controller name, such as one that would be packaged inside a request
0044      * object, and reformat it to a proper class name that a class extending
0045      * Zend_Controller_Action would use.
0046      *
0047      * @param string $unformatted
0048      * @return string
0049      */
0050     public function formatControllerName($unformatted);
0051 
0052     /**
0053      * Formats a string into a module name.  This is used to take a raw
0054      * module name, such as one that would be packaged inside a request
0055      * object, and reformat it to a proper directory/class name that a class extending
0056      * Zend_Controller_Action would use.
0057      *
0058      * @param string $unformatted
0059      * @return string
0060      */
0061     public function formatModuleName($unformatted);
0062 
0063     /**
0064      * Formats a string into an action name.  This is used to take a raw
0065      * action name, such as one that would be packaged inside a request
0066      * object, and reformat into a proper method name that would be found
0067      * inside a class extending Zend_Controller_Action.
0068      *
0069      * @param string $unformatted
0070      * @return string
0071      */
0072     public function formatActionName($unformatted);
0073 
0074     /**
0075      * Returns TRUE if an action can be dispatched, or FALSE otherwise.
0076      *
0077      * @param  Zend_Controller_Request_Abstract $request
0078      * @return boolean
0079      */
0080     public function isDispatchable(Zend_Controller_Request_Abstract $request);
0081 
0082     /**
0083      * Add or modify a parameter with which to instantiate an Action Controller
0084      *
0085      * @param string $name
0086      * @param mixed $value
0087      * @return Zend_Controller_Dispatcher_Interface
0088      */
0089     public function setParam($name, $value);
0090 
0091     /**
0092      * Set an array of a parameters to pass to the Action Controller constructor
0093      *
0094      * @param array $params
0095      * @return Zend_Controller_Dispatcher_Interface
0096      */
0097     public function setParams(array $params);
0098 
0099     /**
0100      * Retrieve a single parameter from the controller parameter stack
0101      *
0102      * @param string $name
0103      * @return mixed
0104      */
0105     public function getParam($name);
0106 
0107     /**
0108      * Retrieve the parameters to pass to the Action Controller constructor
0109      *
0110      * @return array
0111      */
0112     public function getParams();
0113 
0114     /**
0115      * Clear the controller parameter stack
0116      *
0117      * By default, clears all parameters. If a parameter name is given, clears
0118      * only that parameter; if an array of parameter names is provided, clears
0119      * each.
0120      *
0121      * @param null|string|array single key or array of keys for params to clear
0122      * @return Zend_Controller_Dispatcher_Interface
0123      */
0124     public function clearParams($name = null);
0125 
0126     /**
0127      * Set the response object to use, if any
0128      *
0129      * @param Zend_Controller_Response_Abstract|null $response
0130      * @return void
0131      */
0132     public function setResponse(Zend_Controller_Response_Abstract $response = null);
0133 
0134     /**
0135      * Retrieve the response object, if any
0136      *
0137      * @return Zend_Controller_Response_Abstract|null
0138      */
0139     public function getResponse();
0140 
0141     /**
0142      * Add a controller directory to the controller directory stack
0143      *
0144      * @param string $path
0145      * @param string $args
0146      * @return Zend_Controller_Dispatcher_Interface
0147      */
0148     public function addControllerDirectory($path, $args = null);
0149 
0150     /**
0151      * Set the directory where controller files are stored
0152      *
0153      * Specify a string or an array; if an array is specified, all paths will be
0154      * added.
0155      *
0156      * @param string|array $dir
0157      * @return Zend_Controller_Dispatcher_Interface
0158      */
0159     public function setControllerDirectory($path);
0160 
0161     /**
0162      * Return the currently set directory(ies) for controller file lookup
0163      *
0164      * @return array
0165      */
0166     public function getControllerDirectory();
0167 
0168     /**
0169      * Dispatches a request object to a controller/action.  If the action
0170      * requests a forward to another action, a new request will be returned.
0171      *
0172      * @param  Zend_Controller_Request_Abstract $request
0173      * @param  Zend_Controller_Response_Abstract $response
0174      * @return void
0175      */
0176     public function dispatch(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response);
0177 
0178     /**
0179      * Whether or not a given module is valid
0180      *
0181      * @param string $module
0182      * @return boolean
0183      */
0184     public function isValidModule($module);
0185 
0186     /**
0187      * Retrieve the default module name
0188      *
0189      * @return string
0190      */
0191     public function getDefaultModule();
0192 
0193     /**
0194      * Retrieve the default controller name
0195      *
0196      * @return string
0197      */
0198     public function getDefaultControllerName();
0199 
0200     /**
0201      * Retrieve the default action
0202      *
0203      * @return string
0204      */
0205     public function getDefaultAction();
0206 }