src/Request.php
protected function setTarget($target)
    {
        if ('*' == $target) {
            $this->target = $target;

            return $this;
        }
        if (is_string($target)) {
            $target = new Uri($target);
        }

        if (! $target instanceof UriInterface) {
            throw new InvalidArgumentException(sprintf(
                'Invalid target provided; must be an string or instance of '
                . '"%s", "%s" received.',
                'Psr\\Http\\Message\\UriInterface',
                is_object($target) ? get_class($target) : gettype($target)
            ));
        }
        $this->target = (string) $target->withFragment('');

        return $this;
    }
protected function setTarget($target)
    {
        if ('*' == $target) {
            $this->target = $target;

            return $this;
        }
        if (is_string($target)) {
            $target = new Uri($target);
        }

        if (! $target instanceof UriInterface) {
            throw new InvalidArgumentException(sprintf(
                'Invalid target provided; must be an string or instance of '
                . '"%s", "%s" received.',
                'Psr\\Http\\Message\\UriInterface',
                is_object($target) ? get_class($target) : gettype($target)
            ));
        }
        $this->target = (string) $target->withFragment('');

        return $this;
    }
protected function setTarget ( $ target ) { if ( '*' == $ target ) { $ this -> target = $ target ; return $ this ; } if ( is_string ( $ target ) ) { $ target = new Uri ( $ target ) ; } if ( ! $ target instanceof UriInterface ) { throw new InvalidArgumentException ( sprintf ( 'Invalid target provided; must be an string or instance of ' . '"%s", "%s" received.' , 'Psr\\Http\\Message\\UriInterface' , is_object ( $ target ) ? get_class ( $ target ) : gettype ( $ target ) ) ) ; } $ this -> target = ( string ) $ target -> withFragment ( '' ) ; return $ this ; }
Sets the request HTTP target.

@param string|\Psr\Http\Message\UriInterface $target The target

@throws \InvalidArgumentException If invalid target provided

@return self
Sets the request HTTP target .