public static function secureUnknownType(
            $data, 
            string $type,
            bool $htmlentities
    ): string {
        if ($type !== 'html') {
            $data = strip_tags($data);
        }
        
        if ($type === 'html' || $htmlentities === true) {
            return htmlentities($data, ENT_QUOTES | ENT_HTML401);
        }
        
        return addslashes($data);
    }