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;
    }