Java Code Examples for fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#getQualifiedKeyValuesInFile()

The following examples show how to use fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#getQualifiedKeyValuesInFile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServiceContainerUtil.java    From idea-php-symfony2-plugin with MIT License 6 votes vote down vote up
public static void visitFile(@NotNull YAMLFile psiFile, @NotNull Consumer<ServiceConsumer> consumer) {
    ServiceFileDefaults defaults = null;

    for (YAMLKeyValue keyValue : YamlHelper.getQualifiedKeyValuesInFile(psiFile, "services")) {
        if(defaults == null) {
            defaults = createDefaults(psiFile);
        }

        String serviceId = keyValue.getKeyText();
        if(StringUtils.isBlank(serviceId) || "_defaults".equals(serviceId)) {
            continue;
        }

        consumer.consume(new ServiceConsumer(keyValue, serviceId, new YamlKeyValueAttributeValue(keyValue), defaults));
    }
}
 
Example 2
Source File: FormUtil.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
/**
 * acme_demo.form.type.gender:
 *  class: espend\Form\TypeBundle\Form\FooType
 *  tags:
 *   - { name: form.type, alias: foo_type_alias  }
 *   - { name: foo  }
 */
@NotNull
public static Map<String, Set<String>> getTags(@NotNull YAMLFile yamlFile) {
    Map<String, Set<String>> map = new HashMap<>();

    for(YAMLKeyValue yamlServiceKeyValue : YamlHelper.getQualifiedKeyValuesInFile(yamlFile, "services")) {
        String serviceName = yamlServiceKeyValue.getName();
        Set<String> serviceTagMap = YamlHelper.collectServiceTags(yamlServiceKeyValue);
        if(serviceTagMap.size() > 0) {
            map.put(serviceName, serviceTagMap);
        }
    }

    return map;
}
 
Example 3
Source File: ServiceActionUtil.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
/**
 * Gets all services inside yaml file with "arguments" key context
 */
@NotNull
public static Collection<ServiceYamlContainer> getYamlContainerServiceArguments(@NotNull YAMLFile yamlFile) {

    Collection<ServiceYamlContainer> services = new ArrayList<>();

    for(YAMLKeyValue yamlKeyValue : YamlHelper.getQualifiedKeyValuesInFile(yamlFile, "services")) {
        ServiceYamlContainer serviceYamlContainer = ServiceYamlContainer.create(yamlKeyValue);
        if(serviceYamlContainer != null) {
            services.add(serviceYamlContainer);
        }
    }

    return services;
}