示例#1
0
 /**
  * @param string|null $value
  */
 public function __construct($value = null)
 {
     if ($value) {
         HeaderValue::assertValid($value);
         $this->value = $value;
     }
 }
示例#2
0
 /**
  * Create location-based header from string
  *
  * @param string $headerLine
  * @return AbstractLocation
  * @throws Exception\InvalidArgumentException
  */
 public static function fromString($headerLine)
 {
     $locationHeader = new static();
     // ZF-5520 - IIS bug, no space after colon
     list($name, $uri) = GenericHeader::splitHeaderLine($headerLine);
     // check to ensure proper header type for this factory
     if (strtolower($name) !== strtolower($locationHeader->getFieldName())) {
         throw new Exception\InvalidArgumentException('Invalid header line for "' . $locationHeader->getFieldName() . '" header string');
     }
     HeaderValue::assertValid($uri);
     $locationHeader->setUri(trim($uri));
     return $locationHeader;
 }
示例#3
0
 /**
  * Parse a full header line or just the field value part.
  *
  * @param string $headerLine
  */
 public function parseHeaderLine($headerLine)
 {
     if (strpos($headerLine, ':') !== false) {
         list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
         if (strtolower($name) !== strtolower($this->getFieldName())) {
             $value = $headerLine;
             // This is just for preserve the BC.
         }
     } else {
         $value = $headerLine;
     }
     HeaderValue::assertValid($value);
     foreach ($this->getFieldValuePartsFromHeaderLine($value) as $value) {
         $this->addFieldValuePartToQueue($value);
     }
 }
示例#4
0
 /**
  * Set the content-type character set encoding
  *
  * @param  string $charset
  * @return self
  */
 public function setCharset($charset)
 {
     HeaderValue::assertValid($charset);
     $this->parameters['charset'] = $charset;
     $this->value = null;
     return $this;
 }
示例#5
0
 /**
  * @param string $path
  * @return SetCookie
  */
 public function setPath($path)
 {
     HeaderValue::assertValid($path);
     $this->path = $path;
     return $this;
 }