protected function parseUrl(string $url)
    {
        $url = trim($url, '/');

        // Proceed if the URL is still a valid URL
        if (filter_var($url, FILTER_VALIDATE_URL)) {
            // Return an URL with a '/' if is just a domain
            return preg_match('/(\.(?<tld>\w*))$/m', $url)
                ? $url . '/'
                : $url;
        }

        throw new InvalidUrlException($url);
    }