<commit_before><?php

/**
* This file is part of the Meup GeoLocation Bundle.
*
* (c) 1001pharmacies <http://github.com/1001pharmacies/geolocation-bundle>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Meup\Bundle\GeoLocationBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
 * This is the class that loads and manages your bundle configuration
 *
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
 */
class MeupGeoLocationExtension extends Extension
{
    /**
     * {@inheritDoc}
     */
    public function load(array $configs, ContainerBuilder $container)
    {
        $config = $this->processConfiguration(
            new Configuration(), 
            $configs
        );

        $factories = $this->loadFactories($config, $container);
        $handlers  = $this->loadHandlers($config['handlers'], $container);
        $providers = $this->loadProviders($config, $container, $factories);
    }

    /**
     * @param array $config
     * @param ContainerBuilder $container
     *
     * @return Array<Definition>
     */
    protected function loadFactories(array $config, ContainerBuilder $container)
    {
        $result = array();

        foreach (array('address', 'coordinates') as $entity) {
            $result[] = $container->setDefinition(
                sprintf('meup_geolocation.%s_factory', $entity),
                new Definition(
                    $config[$entity]['factory_class'],
                    array(
                        $config[$entity]['entity_class'],
                    )
                )
            );
        }

        return $result;
    }

    /**
     * @param array $config
     * @param ContainerBuilder $container
     *
     * @return void
     */
    protected function loadHandlers(array $config, ContainerBuilder $container)
    {
        $container->setDefinition(
            'meup_geolocation.distance_calculator', 
            new Definition($config['distance_calculator'])
        );

        $container->setDefinition(
            'meup_geolocation.locator', 
            new Definition(
                $config['locator_manager'],
                array(
                    new Reference('logger'),
                )
            )
        );
    }

    /**
     * @param array $config
     * @param ContainerBuilder $container
     *
     * @return Array<Definition>
     */
    protected function loadProviders(array $config, ContainerBuilder $container, $model)
    {
        $http_client = $container->setDefinition(
            'meup_geolocation.http_client',<commit_msg>Unused method, property, variable or parameter<commit_after><?php

/**
* This file is part of the Meup GeoLocation Bundle.
*
* (c) 1001pharmacies <http://github.com/1001pharmacies/geolocation-bundle>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Meup\Bundle\GeoLocationBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
 * This is the class that loads and manages your bundle configuration
 *
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
 */
class MeupGeoLocationExtension extends Extension
{
    /**
     * {@inheritDoc}
     */
    public function load(array $configs, ContainerBuilder $container)
    {
        $config = $this->processConfiguration(
            new Configuration(), 
            $configs
        );

        $factories = $this->loadFactories($config, $container);
        $handlers  = $this->loadHandlers($config, $container);
        $providers = $this->loadProviders($config, $container, $factories);
    }

    /**
     * @param array $config
     * @param ContainerBuilder $container
     *
     * @return Array<Definition>
     */
    protected function loadFactories(array $config, ContainerBuilder $container)
    {
        $result = array();

        foreach (array('address', 'coordinates') as $entity) {
            $result[] = $container->setDefinition(
                sprintf('meup_geolocation.%s_factory', $entity),
                new Definition(
                    $config[$entity]['factory_class'],
                    array(
                        $config[$entity]['entity_class'],
                    )
                )
            );
        }

        return $result;
    }

    /**
     * @param array $config
     * @param ContainerBuilder $container
     *
     * @return void
     */
    protected function loadHandlers(array $config, ContainerBuilder $container)
    {
        $container->setDefinition(
            'meup_geolocation.distance_calculator', 
            new Definition($config['handlers']['distance_calculator'])
        );

        $container->setDefinition(
            'meup_geolocation.locator', 
            new Definition(
                $config['handlers']['locator_manager'],
                array(
                    new Reference('logger'),
                )
            )
        );
    }

    /**
     * @param array $config
     * @param ContainerBuilder $container
     *
     * @return Array<Definition>
     */
    protected function loadProviders(array $config, ContainerBuilder $container, $model)
    {
        $http_client = $container->setDefinition(
            'meup_geolocation.http_client',
{'fraction_non_alphanumeric': 0.11082518442271401, 'fraction_numerical': 0.0027448962086121117, 'mean_word_length': 2.3314285714285714, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '6808296', 'n_tokens_mistral': 1550, 'n_tokens_neox': 1483, 'n_words': 326}