/** * Initialize the class instance variables and then call the action. * * @param Zend_Controller_Dispatcher_Token $action */ public final function run(Zend_Controller_Dispatcher_Interface $dispatcher, Zend_Controller_Dispatcher_Token $action) { $this->_action = $action; $this->_params = $action->getParams(); if (!strlen($action->getActionName())) { $action->setActionName('index'); } $methodName = $dispatcher->formatActionName($action->getActionName()); if (!method_exists($this, $methodName)) { $this->__call($methodName, array()); } else { $method = new ReflectionMethod($this, $methodName); if ($method->isPublic() && !$method->isStatic()) { $this->{$methodName}(); } else { throw new Zend_Controller_Page_Exception('Illegal action called.'); } } $nextAction = $this->_nextAction; $this->_nextAction = null; return $nextAction; }
/** * Runs the current action against the proper controller, recording meta data about the * act for future use. * * @param Zend_Controller_Action $controller The controller being executed * @param Zend_Controller_Dispatcher_Token $action The action within the controller * @return Zend_Controller_Dispatcher_Token The next token in the execution chain */ protected function _runController(Zend_Controller_Action $controller, Zend_Controller_Dispatcher_Token $action) { $currentAction = strtolower($action->getActionName()); $currentController = strtolower($action->getControllerName()); $this->_firstAction = is_null($this->_firstAction) ? $action : $this->_firstAction; $nextAction = $controller->run($this, $action); $this->_actionList->addAction($action); return $nextAction; }