Пример #1
0
 public function __construct($uri = null, $method = null, StreamInterface $body = null, array $headers = null, $protocolVersion = null)
 {
     //Make sure to handle the host header and pass it before
     //we initialize the message-base
     $uri = $this->filterUri($uri);
     if (!isset($headers['Host']) && $uri->getHost()) {
         $headers['Host'] = $uri->getHost();
     }
     parent::__construct($body, $headers, $protocolVersion);
     $this->uri = $uri;
     $this->method = $method !== null ? $this->filterMethod($method) : Verb::GET;
     $this->requestTarget = null;
 }
Пример #2
0
 public function __construct(StreamInterface $body = null, $statusCode = null, array $headers = null, $reasonPhrase = null, $protocolVersion = null)
 {
     parent::__construct($body, $headers, $protocolVersion);
     $this->statusCode = $statusCode !== null ? $this->filterStatusCode($statusCode) : self::DEFAULT_STATUS_CODE;
     $this->reasonPhrase = !empty($reasonPhrase) ? $reasonPhrase : null;
 }