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

        $path = (string) $path;

        if (strpos($path, '?') !== false) {
            throw new InvalidArgumentException(
                'Invalid path provided; must not contain a query string.'
            );
        }

        if (strpos($path, '#') !== false) {
            throw new InvalidArgumentException(
                'Invalid path provided; must not contain a URI fragment.'
            );
        }

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

        return $this;
    }
protected function setPath($path)
    {
        $this->uriString = null;

        $path = (string) $path;

        if (strpos($path, '?') !== false) {
            throw new InvalidArgumentException(
                'Invalid path provided; must not contain a query string.'
            );
        }

        if (strpos($path, '#') !== false) {
            throw new InvalidArgumentException(
                'Invalid path provided; must not contain a URI fragment.'
            );
        }

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

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

@param string $path The path

@throws \InvalidArgumentException If path contain query string or
URI fragment

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