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(); }
/** * Container creates a controller instance or returns false, if * controller couldn't be created. * * @param IRoute $route Routing information about controller * @return mixed Controller instance or false */ public function loadController(IRoute $route) { $package = $route->getPackage(); $name = $route->getController(); $fileName = $this->controllerNaming->getFileName($name); $class = $this->controllerNaming->getClassName($name); if (!$this->includeController($package, $class, $fileName)) { return false; } else { $controller = $this->container->getInstanceOf($class); $controller->setContainer($this->container); return $controller; } }