setParams($params); } /** * Add or modify a parameter to use when instantiating an action controller * * @param string $name * @param mixed $value * @return Zend_Controller_Router */ public function setParam($name, $value) { $name = (string) $name; $this->_invokeParams[$name] = $value; return $this; } /** * Set parameters to pass to action controller constructors * * @param array $params * @return Zend_Controller_Router */ public function setParams(array $params) { $this->_invokeParams = array_merge($this->_invokeParams, $params); return $this; } /** * Retrieve a single parameter from the controller parameter stack * * @param string $name * @return mixed */ public function getParam($name) { if(isset($this->_invokeParams[$name])) { return $this->_invokeParams[$name]; } return null; } /** * Retrieve action controller instantiation parameters * * @return array */ public function getParams() { return $this->_invokeParams; } /** * Clear the controller parameter stack * * By default, clears all parameters. If a parameter name is given, clears * only that parameter; if an array of parameter names is provided, clears * each. * * @param null|string|array single key or array of keys for params to clear * @return Zend_Controller_Router */ public function clearParams($name = null) { if (null === $name) { $this->_invokeParams = array(); } elseif (is_string($name) && isset($this->_invokeParams[$name])) { unset($this->_invokeParams[$name]); } elseif (is_array($name)) { foreach ($name as $key) { if (is_string($key) && isset($this->_invokeParams[$key])) { unset($this->_invokeParams[$key]); } } } return $this; } /** * Retrieve Front Controller * * @return Zend_Controller_Front */ public function getFrontController() { // Used cache version if found if (null !== $this->_frontController) { return $this->_frontController; } #require_once 'Zend/Controller/Front.php'; $this->_frontController = Zend_Controller_Front::getInstance(); return $this->_frontController; } /** * Set Front Controller * * @param Zend_Controller_Front $controller * @return Zend_Controller_Router_Interface */ public function setFrontController(Zend_Controller_Front $controller) { $this->_frontController = $controller; return $this; } }