public function handle(IEvent $event) { $route = $event->getParameter('route'); $controller = $event->getParameter('controller'); if (!$this->invoker->canInvoke($controller, $route)) { return false; } $result = $this->invoker->invoke($controller, $route); $event->setValue($result); return true; }
public function handle(IEvent $event) { $presenter = $event->getParameter('presenter'); $route = $event->getParameter('route'); $paths = $this->paths->getPaths($route->getPackage() . '.views'); foreach ($paths as $path) { $filename = $path . '/' . $presenter->getViewName() . $this->defaultExt; if (file_exists($filename)) { $rendered = $presenter->getOriginalResponse(); $rendered->setContent($this->renderView($filename, $presenter->getVariables())); $event->setValue($rendered); return true; } } return false; }
public function handle(IEvent $event) { $request = $event->getParameter('request'); $route = $this->router->fetchRoute($request->getPathInfo()); $event->setValue($route); return $route !== false; }
public function handle(IEvent $event) { $route = $event->getParameter('route'); $controller = $this->loader->loadController($route); if ($controller) { $event->setValue($controller); return true; } else { return false; } }
public function handle(IEvent $event) { $presenter = $event->getParameter('presenter'); $viewname = $presenter->getViewName() . $this->defaultExtension; $variables = $presenter->getVariables(); try { $template = $this->twig->loadTemplate($viewname); } catch (RuntimeException $e) { // do not fail when template couldn't be found if (strpos($e->getMessage(), 'Unable to find template') === 0) { return false; } throw $e; } $content = $template->render($presenter->getVariables()); $response = $presenter->getOriginalResponse(); $response->write($content); $event->setValue($response); return true; }
public function handleControllerView(IEvent $e) { $presenter = $e->getParameter('presenter'); $response = $presenter->getOriginalResponse(); $variables = $presenter->getVariables(); $response->setContent($variables['parameter']); $e->setValue($response); return true; }