<commit_before><?php
namespace Iltar\HttpBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
 * @author <NAME> <<EMAIL>>
 */
final class IltarHttpExtension extends Extension
{
    /**
     * {@inheritdoc}
     */
    public function load(array $config, ContainerBuilder $container)
    {
        $config = $this->processConfiguration($this->getConfiguration([], $container), $config);
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

        $this->processRouterConfig($config['router'], $container, $loader);
    }

    /**
     * @param array            $config
     * @param ContainerBuilder $container
     * @param XmlFileLoader    $loader
     */
    private function processRouterConfig(array $config, ContainerBuilder $container, XmlFileLoader $loader)
    {
        if (!$this->isConfigEnabled($container, $config)) {
            return;
        }

        $loader->load('router.xml');

        $mapping = $this->convertMappedGetters($config['mapped_properties']);

        $container->getDefinition('iltar_http.router.mapped_properties')->replaceArgument(1, $mapping);

        if (false !== $config['entity_id_resolver']) {
            $loader->load('entity_id_resolver.xml');
        }
    }

    /**
     * @param array $mapping
     * @return array<commit_msg>Added class cache support<commit_after><?php
namespace Iltar\HttpBundle\DependencyInjection;

use Iltar\HttpBundle\DoctrineBridge\Router\EntityIdResolver;
use Iltar\HttpBundle\Router\MappablePropertyPathResolver;
use Iltar\HttpBundle\Router\ParameterResolverInterface;
use Iltar\HttpBundle\Router\ParameterResolvingRouter;
use Iltar\HttpBundle\Router\ResolverCollection;
use Iltar\HttpBundle\Router\ResolverCollectionInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
 * @author <NAME> <<EMAIL>>
 */
final class IltarHttpExtension extends Extension
{
    /**
     * {@inheritdoc}
     */
    public function load(array $config, ContainerBuilder $container)
    {
        $config = $this->processConfiguration($this->getConfiguration([], $container), $config);
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

        $this->processRouterConfig($config['router'], $container, $loader);
    }

    /**
     * @param array            $config
     * @param ContainerBuilder $container
     * @param XmlFileLoader    $loader
     */
    private function processRouterConfig(array $config, ContainerBuilder $container, XmlFileLoader $loader)
    {
        if (!$this->isConfigEnabled($container, $config)) {
            return;
        }

        $loader->load('router.xml');
        $mapping = $this->convertMappedGetters($config['mapped_properties']);
        $container->getDefinition('iltar_http.router.mapped_properties')->replaceArgument(1, $mapping);

        $this->addClassesToCompile([
            MappablePropertyPathResolver::class,
            ParameterResolverInterface::class,
            ParameterResolvingRouter::class,
            ResolverCollectionInterface::class,
            ResolverCollection::class,
        ]);

        if (false !== $config['entity_id_resolver']) {
            $loader->load('entity_id_resolver.xml');
            $this->addClassesToCompile([EntityIdResolver::class]);
        }
    }

    /**
     * @param array $mapping
     * @return array
{'fraction_non_alphanumeric': 0.1276256314809891, 'fraction_numerical': 0.0005317734645041213, 'mean_word_length': 3.5655339805825244, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5555299', 'n_tokens_mistral': 1023, 'n_tokens_neox': 1002, 'n_words': 167}