public function setQuery(array $query) : Request
    {
        $this->queryString = http_build_query($query);

        // Ensure that we get a value for getQuery() that's consistent with the query string, and whose scalar values
        // have all been converted to strings, to get a result similar to what we'd get with an incoming HTTP request.
        parse_str($this->queryString, $this->query);

        $this->requestUri = $this->path;

        if ($this->queryString !== '') {
            $this->requestUri .= '?' . $this->queryString;
        }

        return $this;
    }