Commit 0de4b2d7 authored by Fabien Potencier's avatar Fabien Potencier

merged branch Tobion/patch-3 (PR #767)

This PR was merged into the master branch.

Discussion
----------

small optimization

Commits
-------

bf719221 small optimization
parents 4c62c283 bf719221
...@@ -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