function FragmentHandler::deliver
Delivers the Response as a string.
When the Response is a StreamedResponse, the content is streamed immediately instead of being returned.
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 94
Class
- FragmentHandler
- Renders a URI that represents a resource fragment.
Namespace
Symfony\Component\HttpKernel\FragmentCode
protected function deliver(Response $response) : ?string {
if (!$response->isSuccessful()) {
$responseStatusCode = $response->getStatusCode();
throw new \RuntimeException(\sprintf('Error when rendering "%s" (Status code is %d).', $this->requestStack
->getCurrentRequest()
->getUri(), $responseStatusCode), 0, new HttpException($responseStatusCode));
}
if (!$response instanceof StreamedResponse) {
return $response->getContent();
}
$response->sendContent();
return null;
}