/** * Gets a HTTP header value * @param string $name Name of the header * @return string|array|null The value of the header, an array of values if * the header is set multiple times, null if not set * @see zibo\library\http\Header */ public function getHeader($name) { if (!$this->headers) { $this->headers = new HeaderContainer(); $this->headers->setHeadersFromServerRequest(); } if (!$this->headers->hasHeader($name)) { return null; } $header = $this->headers->getHeader($name); if (!is_array($header)) { return $header->getValue(); } $values = array(); foreach ($header as $h) { $values[] = $h->getValue(); } return $values; }
/** * Checks if a header is set * @param string $name The name of the header * @return boolean True if the header is set, false otherwise */ public function hasHeader($name) { return $this->headers->hasHeader($name); }