public function getBasicResponse()
{
// Default the basic response
if ($this->basicResponse === null) {
$this->basicResponse = function () {
if (headers_sent()) {
throw new RuntimeException('Attempting basic auth after headers have already been sent.');
}
header('WWW-Authenticate: Basic');
header('HTTP/1.0 401 Unauthorized');
echo 'Invalid credentials.';
exit;
};
}
$response = $this->basicResponse;
return $response();
}