Exemplo n.º 1
0
 /**
  * @param ApplicationInterface $app
  *
  * @throws Exception
  */
 public function run(ApplicationInterface $app)
 {
     $this->setApplication($app);
     $viewName = $this->getViewName($app);
     if (!$viewName) {
         return;
     }
     $viewPath = $this->resolveViewPath($viewName);
     $app->setParam('view.script', $viewPath);
     $output = $this->render($viewPath);
     // handle layout
     if ($layoutName = $this->getLayoutName()) {
         $layoutPath = $this->resolveLayoutPath($layoutName);
         Vars::set('view.output', $output);
         $output = $this->render($layoutPath);
         Vars::unset('view.output');
     }
     $app->getResponse()->getBody()->rewind();
     $app->getResponse()->getBody()->write($output);
 }