コード例 #1
0
 /**
  * Call controller's action with parameters
  *
  * @param Object $controller
  * @param IRoute $route
  * @return mixed
  */
 public function invoke($controller, IRoute $route)
 {
     $action = $this->naming->getName($route->getAction());
     $method = $this->getActionMethod($controller, $action);
     $arguments = $this->findArguments($method, $route->getParameters());
     return $method->invokeArgs($controller, $arguments);
 }
コード例 #2
0
 protected function notifyView(IRoute $route, IResponsePresenter $presenter)
 {
     $this->emitter->notify(new Event($this, 'controller.view_context', array('route' => $route, 'presenter' => $presenter)));
     $event = new Event($this, 'controller.view', array('route' => $route, 'presenter' => $presenter));
     $this->emitter->notifyUntil($event);
     if (!$event->isHandled()) {
         throw new RuntimeException("No template applied for '{$presenter->getViewName()}' view name, which was called by '{$route->getController()}/{$route->getAction()}'");
     }
     return $event->getValue();
 }
コード例 #3
0
 /**
  * Transform the action name by using actionNaming,
  * find the Command name identifier inside the $controller::getCommands().
  * If command is not set, return false.
  *
  * @param mixed $controller
  * @param IRoute $route
  * @return mixed
  */
 protected function getCommandIdentifier($controller, IRoute $route)
 {
     $commands = $controller->getCommands();
     $actionName = $this->actionNaming->getName($route->getAction());
     return isset($commands[$actionName]) ? $commands[$actionName] : false;
 }