<commit_before><?php

namespace Ekyna\Bundle\AdminBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
 * Class Configuration
 * @package Ekyna\Bundle\AdminBundle\DependencyInjection
 * @author <NAME> <<EMAIL>>
 */
class Configuration implements ConfigurationInterface
{
    /**
     * {@inheritDoc}
     */
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('ekyna_admin');

        $rootNode
            ->children()
                ->scalarNode('logo_path')->defaultValue('/bundles/ekynaadmin/img/logo.png')->end()
                ->scalarNode('output_dir')->defaultValue('')->end()
                ->append($this->getResourcesSection())
                ->append($this->getMenusSection())
                ->arrayNode('css_inputs')
                    ->prototype('scalar')
                    ->treatNullLike(array())
                    ->defaultValue(array())
                ->end()
            ->end()
        ;

        return $treeBuilder;
    }

    /**
     * Returns the resources configuration definition.
     *
     * @return \Symfony\Component\Config\Definition\Builder\NodeDefinition
     */
    private function getResourcesSection()
    {
        $builder = new TreeBuilder();
        $node = $builder->root('resources');

        $node
            ->useAttributeAsKey('prefix')
            ->prototype('array')
                ->useAttributeAsKey('name')
                ->prototype('array')
                    ->children()
                        ->variableNode('templates')->end() // TODO normalization ?
                        ->scalarNode('entity')->isRequired()->cannotBeEmpty()->end()
                        ->scalarNode('controller')->end()
                        ->scalarNode('repository')->end()
                        ->scalarNode('operator')->end()
                        ->scalarNode('form')->isRequired()->cannotBeEmpty()->end()
                        ->scalarNode('table')->isRequired()->cannotBeEmpty()->end()
                        ->scalarNode('parent')->end()
                        ->scalarNode('event')->end()
                        ->arrayNode('translation')
                            ->children()
                                ->scalarNode('entity')->end()
                                ->scalarNode('repository')->end()
                            ->end()
                        ->end()<commit_msg>Resources translation fields configuration.<commit_after><?php

namespace Ekyna\Bundle\AdminBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
 * Class Configuration
 * @package Ekyna\Bundle\AdminBundle\DependencyInjection
 * @author <NAME> <<EMAIL>>
 */
class Configuration implements ConfigurationInterface
{
    /**
     * {@inheritDoc}
     */
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('ekyna_admin');

        $rootNode
            ->children()
                ->scalarNode('logo_path')->defaultValue('/bundles/ekynaadmin/img/logo.png')->end()
                ->scalarNode('output_dir')->defaultValue('')->end()
                ->append($this->getResourcesSection())
                ->append($this->getMenusSection())
                ->arrayNode('css_inputs')
                    ->prototype('scalar')
                    ->treatNullLike(array())
                    ->defaultValue(array())
                ->end()
            ->end()
        ;

        return $treeBuilder;
    }

    /**
     * Returns the resources configuration definition.
     *
     * @return \Symfony\Component\Config\Definition\Builder\NodeDefinition
     */
    private function getResourcesSection()
    {
        $builder = new TreeBuilder();
        $node = $builder->root('resources');

        $node
            ->useAttributeAsKey('prefix')
            ->prototype('array')
                ->useAttributeAsKey('name')
                ->prototype('array')
                    ->children()
                        ->variableNode('templates')->end() // TODO normalization ?
                        ->scalarNode('entity')->isRequired()->cannotBeEmpty()->end()
                        ->scalarNode('controller')->end()
                        ->scalarNode('repository')->end()
                        ->scalarNode('operator')->end()
                        ->scalarNode('event')->end()
                        ->scalarNode('form')->isRequired()->cannotBeEmpty()->end()
                        ->scalarNode('table')->isRequired()->cannotBeEmpty()->end()
                        ->scalarNode('parent')->end()
                        ->arrayNode('translation')
                            ->children()
                                ->scalarNode('entity')->end()
                                ->scalarNode('repository')->end()
                                ->arrayNode('fields')
                                    ->prototype('scalar')->end()
                                    ->defaultValue(array())
                                ->end()
                            ->end()
                        ->end()
{'fraction_non_alphanumeric': 0.1478912839737582, 'fraction_numerical': 0.0, 'mean_word_length': 1.5629202689721422, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 126, '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': '6328292', 'n_tokens_mistral': 1226, 'n_tokens_neox': 1155, 'n_words': 164}