/**
* Send a response
*
* @param Response $response Response object
* @return Response
*/
public function send(Response $response)
{
if ($this->response_sent) {
if ($this->response_sent !== $response) {
_elgg_services()->logger->error('Unable to send the following response: ' . PHP_EOL . (string) $response . PHP_EOL . 'because another response has already been sent: ' . PHP_EOL . (string) $this->response_sent);
}
} else {
if (!elgg_trigger_before_event('send', 'http_response', $response)) {
return false;
}
if (!$this->transport->send($response)) {
return false;
}
elgg_trigger_after_event('send', 'http_response', $response);
$this->response_sent = $response;
}
return $this->response_sent;
}