public function isSecure()
    {
        return (
            (!empty($this->server['HTTPS']) && $this->server['HTTPS'] != 'off') || 
            (!empty($this->server['HTTP_HTTPS']) && $this->server['HTTP_HTTPS'] != 'off') || 
            $this->server['REQUEST_SCHEME'] == 'https' || $this->server['SERVER_PORT'] == 443
        );
    }