if (self::DISABLED ===
$this->mode
|| !
$response->headers->
has('X-Debug-Token'
) ||
$response->
isRedirection() || ($response->headers->
has('Content-Type'
) && !
str_contains($response->headers->
get('Content-Type'
) ?? '', 'html'
)) || 'html' !==
$request->
getRequestFormat() || false !==
stripos($response->headers->
get('Content-Disposition', ''
), 'attachment;'
) ) { return;
} $this->
injectToolbar($response,
$request,
$nonces);
} /**
* Injects the web debug toolbar into the given Response.
*/
protected function injectToolbar(Response
$response, Request
$request, array
$nonces): void
{ $content =
$response->
getContent();
$pos =
strripos($content, '</body>'
);
if (false !==
$pos) {