Commit bf719221 authored by Tobias Schultze's avatar Tobias Schultze

small optimization

parent 1f1fc4e6
...@@ -34,10 +34,6 @@ trait TwigTrait ...@@ -34,10 +34,6 @@ trait TwigTrait
*/ */
public function render($view, array $parameters = array(), Response $response = null) public function render($view, array $parameters = array(), Response $response = null)
{ {
if (null === $response) {
$response = new Response();
}
$twig = $this['twig']; $twig = $this['twig'];
if ($response instanceof StreamedResponse) { if ($response instanceof StreamedResponse) {
...@@ -45,6 +41,9 @@ trait TwigTrait ...@@ -45,6 +41,9 @@ trait TwigTrait
$twig->display($view, $parameters); $twig->display($view, $parameters);
}); });
} else { } else {
if (null === $response) {
$response = new Response();
}
$response->setContent($twig->render($view, $parameters)); $response->setContent($twig->render($view, $parameters));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment