Sleepness/UberTranslationBundle

View on GitHub
DependencyInjection/SleepnessUberTranslationExtension.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace Sleepness\UberTranslationBundle\DependencyInjection;

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

/**
 * Extension class for process bundle configuration
 *
 * @author Viktor Novikov <viktor.novikov95@gmail.com>
 * @author Alexandr Zhulev <alexandrzhulev@gmail.com>
 */
class SleepnessUberTranslationExtension extends Extension
{
    /**
     * {@inheritDoc}
     */
    public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        $container->setParameter('sleepness_uber_translation.memcached.host', $config['memcached']['host']);
        $container->setParameter('sleepness_uber_translation.memcached.port', $config['memcached']['port']);

        $container->setParameter('sleepness_uber_translation.supported_locales', $config['supported_locales']);

        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('services.xml');
    }
}