src/Uri.php
protected function fromString($uri)
    {
        if (! is_string($uri)) {
            throw new InvalidArgumentException(sprintf(
                '"%s()" expects string; "%s" received.',
                __METHOD__,
                is_object($uri) ? get_class($uri) : gettype($uri)
            ));
        }

        $this
            ->setUserInfo(
                parse_url($uri, PHP_URL_USER),
                parse_url($uri, PHP_URL_PASS)
            )
            ->setScheme(parse_url($uri,   PHP_URL_SCHEME))
            ->setHost(parse_url($uri,     PHP_URL_HOST))
            ->setPath(parse_url($uri,     PHP_URL_PATH))
            ->setQuery(parse_url($uri,    PHP_URL_QUERY))
            ->setFragment(parse_url($uri, PHP_URL_FRAGMENT));

        if ($port = parse_url($uri, PHP_URL_PORT)) {
            $this->setPort($port);
        }

        return $this;
    }
protected function fromString($uri)
    {
        if (! is_string($uri)) {
            throw new InvalidArgumentException(sprintf(
                '"%s()" expects string; "%s" received.',
                __METHOD__,
                is_object($uri) ? get_class($uri) : gettype($uri)
            ));
        }

        $this
            ->setUserInfo(
                parse_url($uri, PHP_URL_USER),
                parse_url($uri, PHP_URL_PASS)
            )
            ->setScheme(parse_url($uri,   PHP_URL_SCHEME))
            ->setHost(parse_url($uri,     PHP_URL_HOST))
            ->setPath(parse_url($uri,     PHP_URL_PATH))
            ->setQuery(parse_url($uri,    PHP_URL_QUERY))
            ->setFragment(parse_url($uri, PHP_URL_FRAGMENT));

        if ($port = parse_url($uri, PHP_URL_PORT)) {
            $this->setPort($port);
        }

        return $this;
    }
protected function fromString ( $ uri ) { if ( ! is_string ( $ uri ) ) { throw new InvalidArgumentException ( sprintf ( '"%s()" expects string; "%s" received.' , __METHOD__ , is_object ( $ uri ) ? get_class ( $ uri ) : gettype ( $ uri ) ) ) ; } $ this -> setUserInfo ( parse_url ( $ uri , PHP_URL_USER ) , parse_url ( $ uri , PHP_URL_PASS ) ) -> setScheme ( parse_url ( $ uri , PHP_URL_SCHEME ) ) -> setHost ( parse_url ( $ uri , PHP_URL_HOST ) ) -> setPath ( parse_url ( $ uri , PHP_URL_PATH ) ) -> setQuery ( parse_url ( $ uri , PHP_URL_QUERY ) ) -> setFragment ( parse_url ( $ uri , PHP_URL_FRAGMENT ) ) ; if ( $ port = parse_url ( $ uri , PHP_URL_PORT ) ) { $ this -> setPort ( $ port ) ; } return $ this ; }
Forms the an object from an URI string.

@param string $uri The URI string

@throws InvalidArgumentException On non-string $uri argument

@return Uri The current instance
Forms the an object from an URI string .