Пример #1
0
 /**
  * Request construct.
  *
  * @param string $method The request method.
  * @param Uri $uri The request URI object.
  * @param Headers $headers The request headers collection.
  * @param array $cookies The request cookies collection.
  * @param StreamInterface $body The request body object.
  * @param array $uploadedFile The request uploadedFiles collection.
  */
 public function __construct($method, Uri $uri, Headers $headers, array $cookies, StreamInterface $body, array $uploadedFile)
 {
     $this->method = $method;
     $this->uri = $uri;
     $this->headers = $headers;
     $this->cookies = $cookies;
     $this->attributes = new Collection(array());
     $this->body = $body;
     $this->uploadedFiles = $uploadedFile;
     if (!$this->headers->has('Host') || $this->uri->getHost() !== '') {
         $this->headers->set('Host', $this->uri->getHost());
     }
 }
Пример #2
0
 /**
  * Checks if a header exists by the given case-insensitive name.
  *
  * @param string $name Case-insensitive header field name.
  * @return bool Returns true if any header names match the given header
  *     name using a case-insensitive string comparison. Returns false if
  *     no matching header name is found in the message.
  */
 public function hasHeader($name)
 {
     return $this->headers ? $this->headers->has($name) : false;
 }