/** * Send the HTTP headers to the client. * * @param bool $include_content_length Optionaly disable the Content-Length header. */ public function sendHeaders($include_content_length = true) { if (headers_sent()) { return; } if ($include_content_length) { $this->headers->set('Content-Length', $this->length); } 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)); } }
/** * Store route objects. * * @param string $name * @param Proem\Routing\Route\Template $route * @return Proem\Signal\Manager\Template */ public function attach($name, Route $route) { $this->routes->set($name, $route); return $this; }