protected function ensureSslEndpoint($url)
    {
        // If the endpoint isn't on SSL
        if (substr($url, 0, 5) != 'https') {
            // Force an SSL endpoint
            $endpoint = parse_url($url);
            $url = 'https://' . $endpoint['host'] . $endpoint['path'];
        }

        // SSL already enabled
        return $url;
    }