src/Uri.php
protected function setQuery($query)
    {
        $this->uriString = null;

        $query = ltrim($query, '?');

        if (strpos($query, '#') !== false) {
            throw new InvalidArgumentException(
                'Query string must not include a URI fragment.'
            );
        }

        $this->query = static::encode($query);

        return $this;
    }
protected function setQuery($query)
    {
        $this->uriString = null;

        $query = ltrim($query, '?');

        if (strpos($query, '#') !== false) {
            throw new InvalidArgumentException(
                'Query string must not include a URI fragment.'
            );
        }

        $this->query = static::encode($query);

        return $this;
    }
protected function setQuery ( $ query ) { $ this -> uriString = null ; $ query = ltrim ( $ query , '?' ) ; if ( strpos ( $ query , '#' ) !== false ) { throw new InvalidArgumentException ( 'Query string must not include a URI fragment.' ) ; } $ this -> query = static :: encode ( $ query ) ; return $ this ; }
Sets the provided query string to current instance.

@param string $query The query string

@throws \InvalidArgumentException If query string contain URI fragment

@return Uri The current instance with the provided query string
Sets the provided query string to current instance .