[TwigBundle] Extract output buffer cleaning to method
This commit is contained in:
parent
ed1a6c2e45
commit
29e12affb0
@ -37,15 +37,7 @@ class ExceptionController extends ContainerAware
|
||||
{
|
||||
$this->container->get('request')->setRequestFormat($format);
|
||||
|
||||
// the count variable avoids an infinite loop on
|
||||
// some Windows configurations where ob_get_level()
|
||||
// never reaches 0
|
||||
$count = 100;
|
||||
$startObLevel = $this->container->get('kernel')->getStartObLevel();
|
||||
$currentContent = '';
|
||||
while (ob_get_level() > $startObLevel && --$count) {
|
||||
$currentContent .= ob_get_clean();
|
||||
}
|
||||
$currentContent = $this->getAndCleanOutputBuffering();
|
||||
|
||||
$templating = $this->container->get('templating');
|
||||
$code = $exception->getStatusCode();
|
||||
@ -67,6 +59,21 @@ class ExceptionController extends ContainerAware
|
||||
return $response;
|
||||
}
|
||||
|
||||
protected function getAndCleanOutputBuffering()
|
||||
{
|
||||
// the count variable avoids an infinite loop on
|
||||
// some Windows configurations where ob_get_level()
|
||||
// never reaches 0
|
||||
$count = 100;
|
||||
$startObLevel = $this->container->get('kernel')->getStartObLevel();
|
||||
$currentContent = '';
|
||||
while (ob_get_level() > $startObLevel && --$count) {
|
||||
$currentContent .= ob_get_clean();
|
||||
}
|
||||
|
||||
return $currentContent;
|
||||
}
|
||||
|
||||
protected function findTemplate($templating, $format, $code, $debug)
|
||||
{
|
||||
$name = $debug ? 'exception' : 'error';
|
||||
|
Reference in New Issue
Block a user