<commit_before>package de.espend.idea.shopware.util;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.patterns.PlatformPatterns;
import com.intellij.patterns.PsiElementPattern;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiWhiteSpace;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.indexing.FileBasedIndexImpl;
import com.jetbrains.php.PhpIndex;
import com.jetbrains.php.lang.psi.elements.*;
import com.jetbrains.php.lang.psi.elements.impl.AssignmentExpressionImpl;
import com.jetbrains.smarty.SmartyFile;
import de.espend.idea.shopware.index.InitResourceServiceIndex;
import de.espend.idea.shopware.index.dict.BootstrapResource;
import de.espend.idea.shopware.index.dict.ServiceResource;
import de.espend.idea.shopware.index.utils.SubscriberIndexUtil;
import fr.adrienbrault.idea.symfony2plugin.util.PhpElementsUtil;
import fr.adrienbrault.idea.symfony2plugin.util.PsiElementUtils;
import org.apache.commons.lang.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ShopwareUtil {

    public static Set<String> PLUGIN_CONFIGS = ContainerUtil.newHashSet();

    final public static String[] PLUGIN_CONFIG_TYPES = new String[] {
        "text", "color", "datetime", "html", "interval", "mediaselection", "number", "select", "combo", "textarea", "time"
    };

    final public static String[] PLUGIN_CONFIG_OPTIONS = new String[] {
        "label", "value", "scope", "description", "required", "attributes", "store", "inputType"
    };

    final public static String[] PLUGIN_INFO = new String[] {
        "version", "author", "label", "license", "copyright", "support", "link"
    };

    final public static String[] CONTAINER_SERVICE_PREFIX = new String[] {
        "Enlight_Bootstrap_AfterInitResource_", "Enlight_Bootstrap_AfterRegisterResource_", "Enlight_Bootstrap_InitResource_"
    };

    // @TODO: hell not here; we can get them from models!
    final public static String[] MODEL_STATIC_ATTRIBUTES = new String[] {
        "s_user_attributes", "s_articles_downloads_attributes", "s_articles_esd_attributes", "s_articles_img_attributes",
        "s_articles_information_attributes", "s_articles_prices_attributes", "s_articles_supplier_attributes", "s_article_configurator_templates_attributes",
        "s_article_configurator_template_prices_attributes", "s_blog_attributes", "s_categories_attributes", "s_cms_static_attributes",
        "s_cms_support_attributes", "s_core_auth_attributes", "s_core_config_mails_attributes", "s_core_countries_attributes", "s_core_countries_states_attributes",
        "s_core_customergroups_attributes", "s_core_paymentmeans_attributes", "s_emarketing_banners_attributes", "s_emarketing_vouchers_attributes",
        "s_emotion_attributes", "s_export_attributes", "s_filter_attributes", "s_media_attributes", "s_order_attributes", "s_order_basket_attributes",
        "s_order_billingaddress_attributes", "s_order_details_attributes", "s_order_documents_attributes", "s_order_shippingaddress_attributes", "s_premium_dispatch_attributes",
        "s_user_attributes", "s_user_billingaddress_attributes", "s_user_shippingaddress_attributes"
    };

    final public static String[] MODEL_STATIC_ATTRIBUTE_TYPES = new String[] {
        "int(11)", "int(1)", "varchar(255)", "datetime", "mediumtext", "date", "decimal(10,2)", "double", "text"<commit_msg>Add A 3 new attribute tables<commit_after>package de.espend.idea.shopware.util;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.patterns.PlatformPatterns;
import com.intellij.patterns.PsiElementPattern;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiWhiteSpace;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.indexing.FileBasedIndexImpl;
import com.jetbrains.php.PhpIndex;
import com.jetbrains.php.lang.psi.elements.*;
import com.jetbrains.php.lang.psi.elements.impl.AssignmentExpressionImpl;
import com.jetbrains.smarty.SmartyFile;
import de.espend.idea.shopware.index.InitResourceServiceIndex;
import de.espend.idea.shopware.index.dict.BootstrapResource;
import de.espend.idea.shopware.index.dict.ServiceResource;
import de.espend.idea.shopware.index.utils.SubscriberIndexUtil;
import fr.adrienbrault.idea.symfony2plugin.util.PhpElementsUtil;
import fr.adrienbrault.idea.symfony2plugin.util.PsiElementUtils;
import org.apache.commons.lang.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ShopwareUtil {

    public static Set<String> PLUGIN_CONFIGS = ContainerUtil.newHashSet();

    final public static String[] PLUGIN_CONFIG_TYPES = new String[] {
        "text", "color", "datetime", "html", "interval", "mediaselection", "number", "select", "combo", "textarea", "time"
    };

    final public static String[] PLUGIN_CONFIG_OPTIONS = new String[] {
        "label", "value", "scope", "description", "required", "attributes", "store", "inputType"
    };

    final public static String[] PLUGIN_INFO = new String[] {
        "version", "author", "label", "license", "copyright", "support", "link"
    };

    final public static String[] CONTAINER_SERVICE_PREFIX = new String[] {
        "Enlight_Bootstrap_AfterInitResource_", "Enlight_Bootstrap_AfterRegisterResource_", "Enlight_Bootstrap_InitResource_"
    };

    // Get the attribute tables from MYSQL with
    /*
        SELECT TABLE_NAME
        FROM information_schema.TABLES
        WHERE TABLE_SCHEMA = SCHEMA()
        AND TABLE_NAME LIKE '%attributes'
     */
    final public static String[] MODEL_STATIC_ATTRIBUTES = new String[] {
        "s_article_configurator_template_prices_attributes",
        "s_article_configurator_templates_attributes",
        "s_articles_attributes",
        "s_articles_downloads_attributes",
        "s_articles_esd_attributes",
        "s_articles_img_attributes",
        "s_articles_information_attributes",
        "s_articles_prices_attributes",
        "s_articles_supplier_attributes",
        "s_blog_attributes",
        "s_categories_attributes",
        "s_cms_static_attributes",
        "s_cms_support_attributes",
        "s_core_auth_attributes",
        "s_core_config_mails_attributes",
        "s_core_countries_attributes",
        "s_core_countries_states_attributes",
        "s_core_customergroups_attributes",
        "s_core_paymentmeans_attributes",
        "s_emarketing_banners_attributes",
        "s_emarketing_vouchers_attributes",
        "s_emotion_attributes",
        "s_export_attributes",
        "s_filter_attributes",
        "s_filter_options_attributes",
        "s_filter_values_attributes",
        "s_media_attributes",
        "s_order_attributes",
        "s_order_basket_attributes",
        "s_order_billingaddress_attributes",
        "s_order_details_attributes",
        "s_order_documents_attributes",
        "s_order_shippingaddress_attributes",
        "s_premium_dispatch_attributes",
        "s_product_streams_attributes",
        "s_user_addresses_attributes",
        "s_user_attributes",
        "s_user_billingaddress_attributes",
        "s_user_shippingaddress_attributes"
    };

    final public static String[] MODEL_STATIC_ATTRIBUTE_TYPES = new String[] {
        "int(11)", "int(1)", "varchar(255)", "datetime", "mediumtext", "date", "decimal(10,2)", "double", "text"
{'fraction_non_alphanumeric': 0.1108453904101399, 'fraction_numerical': 0.0027502092550520147, 'mean_word_length': 5.136463683052091, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4621000', 'n_tokens_mistral': 2663, 'n_tokens_neox': 2601, 'n_words': 426}