/** * Render a template, possibly store it in cache. Or, if applicable, return the cached result. * * @param string $template the template name * @param array $vars array of context variables * @param array $globals array of global variables * * @return mixed */ public function render($template, $vars = array(), $globals = array()) { // Start the 'stopwatch' for the profiler. $this->app['stopwatch']->start('bolt.render', 'template'); $response = BoltResponse::create($this->app[$this->twigKey]->loadTemplate($template), $vars, $globals); // Stop the 'stopwatch' for the profiler. $this->app['stopwatch']->stop('bolt.render'); return $response; }
/** * Render a template, possibly store it in cache. Or, if applicable, return the cached result. * * @param string $template the template name * @param array $vars array of context variables * @param array $globals array of global variables * * @return \Bolt\Response\BoltResponse */ public function render($template, $vars = [], $globals = []) { $response = BoltResponse::create($this->app[$this->twigKey]->loadTemplate($template), $vars, $globals); $response->setStopwatch($this->app['stopwatch']); return $response; }
public function testGetTemplateName() { $app = $this->getApp(); $response = BoltResponse::create($app['twig']->loadTemplate('error.twig'), []); $this->assertEquals('error.twig', $response->getTemplateName()); }