public static function isHTTPS($server = array())
    {

        $response = false;

        if (empty($server) && isset($_SERVER)) {
            $server = $_SERVER;
            if (!isset($server['SERVER_PORT'])) {
                $server['SERVER_PORT'] = 80;
            }
        } else {
            $server['HTTPS'] = getenv('HTTPS');
            $server['SERVER_PORT'] = getenv('SERVER_PORT');
        }

        if (isset($server['HTTPS']) && $server['HTTPS'] !== 'off'
            || $server['SERVER_PORT'] == 443
        ) {
            $response = true;
        }

        return $response;
    }