예제 #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
 /**
  * Retrieves a comma-separated string of the values for a single header.
  *
  * This method returns all of the header values of the given
  * case-insensitive header name as a string concatenated together using
  * a comma.
  *
  * NOTE: Not all header values may be appropriately represented using
  * comma concatenation. For such headers, use getHeader() instead
  * and supply your own delimiter when concatenating.
  *
  * If the header does not appear in the message, this method MUST return
  * an empty string.
  *
  * @param string $name Case-insensitive header field name.
  * @return string A string of values as provided for the given header
  *    concatenated together using a comma. If the header does not appear in
  *    the message, this method MUST return an empty string.
  */
 public function getHeaderLine($name)
 {
     return implode(',', $this->headers->get($name, array()));
 }