You are here

protected function FragmentHandler::deliver in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-kernel/Fragment/FragmentHandler.php \Symfony\Component\HttpKernel\Fragment\FragmentHandler::deliver()

Delivers the Response as a string.

When the Response is a StreamedResponse, the content is streamed immediately instead of being returned.

Parameters

Response $response A Response instance:

Return value

string|null The Response content or null when the Response is streamed

Throws

\RuntimeException when the Response is not successful

1 call to FragmentHandler::deliver()
FragmentHandler::render in vendor/symfony/http-kernel/Fragment/FragmentHandler.php
Renders a URI and returns the Response content.

File

vendor/symfony/http-kernel/Fragment/FragmentHandler.php, line 133

Class

FragmentHandler
Renders a URI that represents a resource fragment.

Namespace

Symfony\Component\HttpKernel\Fragment

Code

protected function deliver(Response $response) {
  if (!$response
    ->isSuccessful()) {
    throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $this
      ->getRequest()
      ->getUri(), $response
      ->getStatusCode()));
  }
  if (!$response instanceof StreamedResponse) {
    return $response
      ->getContent();
  }
  $response
    ->sendContent();
}