Beispiel #1
0
 /**
  * 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;
 }
Beispiel #2
0
 /**
  * Gets the ETag
  * @return null|string A unique identifier of the current version of
  * the content if set, null otherwise
  */
 public function getETag()
 {
     $header = $this->headers->getHeader(Header::HEADER_ETAG);
     if (!$header) {
         return null;
     }
     return $header->getValue();
 }