public function withRequestTarget($requestTarget)
    {
        $request = clone $this;
        if (preg_match('~^(?:[a-z]+:)?//~i', $requestTarget)) {
            $result = parse_url($requestTarget);
            if (isset($result['user'])) {
                $result['username'] = $result['user'];
                unset($result['user']);
            }
            if (isset($result['pass'])) {
                $result['password'] = $result['pass'];
                unset($result['pass']);
            }
            foreach ($result as $method => $value) {
                $request->$method($value);
            }
            $request->mode('absolute');
            return $request;
        }
        if (preg_match("~^(?:(?P<username>[^:]+)(?::(?P<password>[^@]+))?@)?(?P<host>[^/]+)$~", $requestTarget, $matches)) {
            $request->username($matches['username'] ?: null);
            $request->password($matches['password'] ?: null);
            $request->host($matches['host']);
            $request->mode('authority');
            return $request;
        }
        if ($requestTarget === '*') {
            $request->mode('asterisk');
            return $request;
        }
        $parts = explode('#', $requestTarget);
        if (isset($parts[1])) {
            $request->fragment($parts[1]);
        }
        $parts = explode('?', $parts[0]);
        if (isset($parts[1])) {
            $request->query($parts[1]);
        }
        $request->path($parts[0]);
        return $request;
    }