protected function deny(Response $response, $statusCode)
{
if ($response instanceof BinaryFileResponse) {
return true;
}
if ($response instanceof StreamedResponse) {
return true;
}
if ($response->isRedirection() === true) {
return true;
}
if ($this->ajax === true) {
return false;
}
$contentType = $response->headers->get('Content-Type');
if (empty($contentType) === true && $statusCode >= 400) {
return false;
}
if (count($this->accepts) === 0) {
return false;
}
$contentType = strtolower($contentType);
foreach ($this->accepts as $accept) {
if (strpos($contentType, $accept) !== false) {
return false;
}
}
return true;
}