private static function getBaseUrl()
    {
        if (isset($_SERVER['SERVER_NAME'])) {
            $sProtocol = !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS'])
                == 'on' ? 'https' : 'http';
            return $sProtocol.'://'.$_SERVER['SERVER_NAME'];
        }
        return null;
    }