You are here

public static function Response::closeOutputBuffers in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Response.php \Symfony\Component\HttpFoundation\Response::closeOutputBuffers()

Cleans or flushes output buffers up to target level.

Resulting level can be greater than target level if a non-removable buffer has been encountered.

Parameters

int $targetLevel The target output buffering level:

bool $flush Whether to flush or clean the buffers:

2 calls to Response::closeOutputBuffers()
InlineFragmentRenderer::render in vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php
Additional available options:
Response::send in vendor/symfony/http-foundation/Response.php
Sends HTTP headers and content.

File

vendor/symfony/http-foundation/Response.php, line 1143

Class

Response
Response represents an HTTP response.

Namespace

Symfony\Component\HttpFoundation

Code

public static function closeOutputBuffers($targetLevel, $flush) {
  $status = ob_get_status(true);
  $level = count($status);
  $flags = defined('PHP_OUTPUT_HANDLER_REMOVABLE') ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1;
  while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || $flags === ($s['flags'] & $flags) : $s['del'])) {
    if ($flush) {
      ob_end_flush();
    }
    else {
      ob_end_clean();
    }
  }
}