public function render(Response $response)
{
if ($this->showBar === false) {
return $response;
}
$statusCode = $response->getStatusCode();
if ($this->deny($response, $statusCode) === true) {
return $response;
}
$content = $response->getContent();
$htmlValidatorPanel = $this->getPanel('html-validator');
if (is_null($htmlValidatorPanel) === false && $statusCode === 200) {
$htmlValidatorPanel->setHtml($content);
}
$bar = $this->getBar();
$pos = strripos($content, '</body>');
if ($pos !== false) {
$content = substr($content, 0, $pos) . $bar . substr($content, $pos);
} else {
$content .= $bar;
}
$response->setContent($content);
return $response;
}