/** * Send the HTTP headers to the client. */ public function sendHeaders() { if (headers_sent()) { return; } if (in_array($this->httpStatus, [204, 304])) { $this->headers->remove('Content-Type'); } header(sprintf('HTTP/%s %s %s', $this->httpVersion, $this->getHttpStatus(), $this->getHttpStatus(true))); foreach ($this->headers->all() as $index => $value) { header(sprintf('%s: %s', $index, $value)); } header('Connection: close'); flush(); }