Phly\Http\RequestTrait::initialize PHP Method

initialize() private method

Used by constructors.
private initialize ( null | string $uri = null, null | string $method = null, string | resource | Psr\Http\Message\StreamInterface $body = 'php://memory', array $headers = [] )
$uri null | string URI for the request, if any.
$method null | string HTTP method for the request, if any.
$body string | resource | Psr\Http\Message\StreamInterface Message body, if any.
$headers array Headers for the message, if any.
    private function initialize($uri = null, $method = null, $body = 'php://memory', array $headers = [])
    {
        if (!$uri instanceof UriInterface && !is_string($uri) && null !== $uri) {
            throw new InvalidArgumentException('Invalid URI provided; must be null, a string, or a Psr\\Http\\Message\\UriInterface instance');
        }
        $this->validateMethod($method);
        if (!is_string($body) && !is_resource($body) && !$body instanceof StreamInterface) {
            throw new InvalidArgumentException('Body must be a string stream resource identifier, ' . 'an actual stream resource, ' . 'or a Psr\\Http\\Message\\StreamInterface implementation');
        }
        if (is_string($uri)) {
            $uri = new Uri($uri);
        }
        $this->method = $method;
        $this->uri = $uri;
        $this->stream = $body instanceof StreamInterface ? $body : new Stream($body, 'r');
        list($this->headerNames, $headers) = $this->filterHeaders($headers);
        $this->assertHeaders($headers);
        $this->headers = $headers;
    }