Loads matchers into PHPSpec service container

@param ServiceContainer $container
@param array $params
512395
public function load(ServiceContainer $container, array $params)
    {
        $container->define(
            'ecomdev.matcher.file',
            function () {
                return $this->createFileMatcher();
            },
            ['matchers']
        );

        $container->define(
            'ecomdev.matcher.file_content',
            function () {
                return $this->createFileContentMatcher();
            },
            ['matchers']
        );

        $container->define(
            'ecomdev.matcher.directory',
            function () {
                return $this->createDirectoryMatcher();
            },
            ['matchers']
        );
    }
23689
public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

        $configuration = $this->getConfiguration($configs, $container);
        $config = $this->processConfiguration($configuration, $configs);

        $this->registerWorkflowConfiguration($config['workflows'], $container, $loader);
    }
161445
public static function resolveParams(Container $container, $params)
    {
        $resolvedParams = array();
        foreach($params as $key=>$param) {
            $resolvedParam = null;
            if (is_array($param)) {
                $resolvedParam = self::resolveParams($container, $param);
            } else if (is_string($param)){
                $resolvedParam = $container->resolve($param);
            } else {
                $resolvedParam = $param;
            }
            $resolvedParams[$key] = $resolvedParam;
        }
        return $resolvedParams;
    }
815738
public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $defaults = Yaml::parseFile(__DIR__.'/../Resources/config/cms/config.yml');

        foreach ($configs as $config) {
            foreach ($config as $key => $value) {
                $defaults['networking_init_cms'][ $key ] = $value;
            }
        }

        $config = $this->processConfiguration($configuration, $defaults);

        $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('blocks.xml');
        $loader->load('event_listeners.xml');
        $loader->load('forms.xml');
        $loader->load('menus.xml');
        $loader->load('twig.xml');
        $loader->load('services.xml');
        $loader->load('validators.xml');

        //mongodb is not yet fully supported but will come (eventually)
        if ('custom' !== $config['db_driver']) {
            $loader->load(sprintf('doctrine_%s.xml', $config['db_driver']));
            $loader->load(sprintf('ext_admin_%s.xml', $config['db_driver']));
            $loader->load(sprintf('admin_%s.xml', $config['db_driver']));
        }

        $config['languages'] = $this->addShortLabels($config['languages']);

        $container->setParameter('networking_init_cms.page.languages', $config['languages']);
        $container->setParameter('networking_init_cms.page.templates', $config['templates']);
        $container->setParameter('networking_init_cms.page.content_types', $config['content_types']);
        $container->setParameter(
            'networking_init_cms.translation_fallback_route',
            $config['translation_fallback_route']
        );
        $container->setParameter(
            'networking_init_cms.multiple_media_tags',
            $config['multiple_media_tags']
        );
        $container->setParameter(
            'networking_init_cms.show_tag_tree',
            $config['show_tag_tree']
        );

        if (!$config['admin_toolbar']['toolbar']) {
            $mode = AdminToolbarSubscriber::DISABLED;
        } else {
            $mode = AdminToolbarSubscriber::ENABLED;
        }
        $container->setParameter('networking_init_cms.admin_toolbar.mode', $mode);
        $container->setParameter('networking_init_cms.admin_toolbar.position', $config['admin_toolbar']['position']);

        $container->setParameter('networking_init_cms.404_template', $config['404_template']);
        $container->setParameter('networking_init_cms.no_translation_template', $config['no_translation_template']);
        $container->setParameter('networking_init_cms.admin_menu_groups', $config['admin_menu_groups']);
        $container->setParameter('networking_init_cms.db_driver', $config['db_driver']);

        if ($config['db_driver'] == 'orm') {
            $this->registerDoctrineORMMapping($config);
        }

        $container->setParameter('networking_init_cms.cache.activate', $config['cache']['activate']);
        $container->setParameter('networking_init_cms.cache.cache_time', $config['cache']['cache_time']);
        $cacheClass = $config['cache']['cache_service_class'];
        $reflectionClass = new \ReflectionClass($cacheClass);

        $container->setParameter('networking_init_cms.xml_sitemap.sitemap_url', $config['xml_sitemap']['sitemap_url']);
        $container->setParameter('networking_init_cms.xml_sitemap.additional_links', $config['xml_sitemap']['additional_links']);

        if (in_array('Networking\InitCmsBundle\Lib\PhpCacheInterface', $reflectionClass->getInterfaceNames())) {
            $container->setParameter('networking_init_cms.lib.php_cache.class', $config['cache']['cache_service_class']);
        } else {
            throw new InvalidParameterException('Cache class should implement the PhpCacheInterface interface');
        }
        $this->configureLanguageCookie($config, $container);

        $this->configureClass($config, $container);
    }
329697
public function load(array $configs, ContainerBuilder $container)
    {
        $processor = new Processor();
        $configuration = new Configuration();
        $config = $processor->processConfiguration($configuration, $configs);

        $config = $this->addDefaults($config);

        if ('orm' !== $config['manager_type']) {
            throw new \RuntimeException('Only ORM manager is implemented');
        }

        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('timeline.xml');
        $loader->load(sprintf('timeline_%s.xml', $config['manager_type']));

        // NEXT_MAJOR: Go back to simple xml configuration when bumping requirements to SF 2.6+
        if (interface_exists('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')) {
            $tokenStorageReference = new Reference('security.token_storage');
        } else {
            $tokenStorageReference = new Reference('security.context');
        }

        $container
            ->getDefinition('sonata.timeline.admin.extension')
            ->replaceArgument(1, $tokenStorageReference)
        ;

        $container
            ->getDefinition('sonata.timeline.block.timeline')
            ->replaceArgument(4, $tokenStorageReference)
        ;

        $this->configureClass($config, $container);
        $this->registerDoctrineMapping($config);
    }
596920
public function process(ContainerBuilder $container)
    {
        foreach ($container->findTaggedServiceIds($this->baseTag) as $id => $services) {
            foreach ((array) $services as $service) {
                $this->findAndReplaceTaggedServices($id, $service, $container);
            }
        }
    }
187162
public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('redis.xml');

        $mainConfig = $this->getConfiguration($configs, $container);
        $config = $this->processConfiguration($mainConfig, $configs);

        foreach ($config['class'] as $name => $class) {
            $container->setParameter(sprintf('snc_redis.%s.class', $name), $class);
        }

        foreach ($config['clients'] as $client) {
            $this->loadClient($client, $container);
        }

        if (isset($config['session'])) {
            $this->loadSession($config, $container, $loader);
        }

        if (isset($config['doctrine']) && count($config['doctrine'])) {
            $this->loadDoctrine($config, $container);
        }

        if (isset($config['monolog'])) {
            if (!empty($config['clients'][$config['monolog']['client']]['logging'])) {
                throw new InvalidConfigurationException(sprintf('You have to disable logging for the client "%s" that you have configured under "snc_redis.monolog.client"', $config['monolog']['client']));
            }
            $this->loadMonolog($config, $container);
        }

        if (isset($config['swiftmailer'])) {
            $this->loadSwiftMailer($config, $container);
        }

        if (isset($config['profiler_storage'])) {
            $this->loadProfilerStorage($config, $container, $loader);
        }
    }
190458
public function load(ContainerBuilder $container, array $config) {
        // Client initializer definition
        $clientInitializerDefinition = new Definition(
            ApiClientAwareInitializer::class,
            [
                $config['apiClient']
            ]
        );
        $clientInitializerDefinition->addTag(ContextExtension::INITIALIZER_TAG);

        // Definition for the array contains comparator
        $comparatorDefinition = new Definition(ArrayContainsComparator::class);

        // Comparator initializer definition
        $comparatorInitializerDefinition = new Definition(
            ArrayContainsComparatorAwareInitializer::class,
            [
                new Reference(self::COMPARATOR_SERVICE_ID)
            ]
        );
        $comparatorInitializerDefinition->addTag(ContextExtension::INITIALIZER_TAG);

        // Add all definitions to the container
        $container->setDefinition(self::APICLIENT_INITIALIZER_SERVICE_ID, $clientInitializerDefinition);
        $container->setDefinition(self::COMPARATOR_SERVICE_ID, $comparatorDefinition);
        $container->setDefinition(self::COMPARATOR_INITIALIZER_SERVICE_ID, $comparatorInitializerDefinition);
    }
330746
public function matcher(Container $container)
    {
        $matcher = $container->get('config')->get('routing.matcher', 'default');

        $matcher = strtolower($matcher) === 'default' ? 'sequential' : $matcher;

        $class = sprintf('Windwalker\Router\Matcher\%sMatcher', ucfirst($matcher));

        if (!class_exists($class)) {
            throw new \DomainException(sprintf('Router Matcher: %s not supported.', ucfirst($matcher)));
        }

        return $container->newInstance($class);
    }
1331181
public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('services.xml');

        $config = $this->processConfiguration($this->getConfiguration($configs, $container), $configs);

        $container->setParameter('windows_azure_distribution.config.deployment', $config['deployment']);
        $container->setParameter('windows_azure_distribution.streams', $config['streams']);

        $this->loadSession($config, $container);
        $this->loadAsset($config['assets'], $container);
        $this->loadSharding($config, $container);
        $this->loadServices($config, $container);
        $this->loadKeyValueStore($config, $container, $loader);
    }
162558
public function load(ContainerBuilder $container, array $config)
    {
        $container->setParameter('cjm.local_webserver.configuration.host', $config['host']);
        $container->setParameter('cjm.local_webserver.configuration.port', $config['port']);
        $container->setParameter('cjm.local_webserver.configuration.docroot', $config['docroot']);
        $container->setParameter('cjm.local_webserver.configuration.suites', $config['suites']);
        $container->setParameter('cjm.local_webserver.configuration.router', $config['router']);

        $this->loadEventSubscribers($container);
        $this->loadWebserverController($container);
        $this->loadWebserverConfiguration($container, $config);
    }
705249
public function register(ServiceContainer $container)
    {
        $container->set(ServiceId::CONFIG_FILE, function () {
            return $this->packageFolder . '/resources/config/config.php';
        });

        $container->set(ServiceId::CONFIG, function (ContainerInterface $container) {
            $path = $container->get(ServiceId::CONFIG_FILE);
            if (!file_exists($path)) {
                throw new RuntimeException('Wrong presentation framework configuration path.');
            }
            $fileName = basename($path);
            list(, $extension) = explode('.', $fileName);
            switch (strtolower($extension)) {
                case 'php':
                    return include($path);
                case 'json':
                    return json_decode(file_get_contents($path));
            }
            throw new RuntimeException('Unsupported configuration file type.');
        });

        $container->set(ServiceId::RENDERER, function (ContainerInterface $container) {
            return new SimpleRenderer($container->get(ServiceId::TEMPLATE_FINDER));
        });

        $container->set(ServiceId::TEMPLATE_FINDER, function () {
            return new TemplateFinder([$this->packageFolder . '/resources/views']);
        });

        $container->set(ServiceId::RESOURCE_MANAGER, function (ContainerInterface $container) {
            $config = $container->get(ServiceId::CONFIG);
            return new ResourceManager(
                new AliasRegistry(isset($config['js_aliases']) ? $config['js_aliases'] : []),
                new AliasRegistry(isset($config['css_aliases']) ? $config['css_aliases'] : []),
                new IncludedResourcesRegistry()
            );
        });

        $container->set(ServiceId::HTML_BUILDER, function (ContainerInterface $container) {
            return new HtmlBuilder($container->get(ServiceId::RESOURCE_MANAGER));
        });

        $container->set(ServiceId::BOOTSTRAP_STYLING_CONFIG, function () {
            return include $this->packageFolder . '/resources/config/styling/twitter_bootstrap.php';
        });

        $container->set(ServiceId::FOUNDATION_STYLING_CONFIG, function () {
            return include $this->packageFolder . '/resources/config/styling/foundation.php';
        });

        $container->set(ServiceId::SEMANTIC_UI_STYLING_CONFIG, function () {
            return include $this->packageFolder . '/resources/config/styling/semantic-ui.php';
        });
    }
954304
public function load(array $configs, ContainerBuilder $container)
    {
        $config = $this->processConfiguration($this->getConfiguration($configs, $container), $configs);

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

        $adapters = array();

        foreach ($config['adapters'] as $name => $adapter) {
            $adapters[$name] = $this->createAdapter($name, $adapter, $container, $this->factories);
        }

        $map = array();
        foreach ($config['filesystems'] as $name => $filesystem) {
            $map[$name] = $this->createFilesystem($name, $filesystem, $container, $adapters);
        }

        $container->getDefinition('knp_gaufrette.filesystem_map')
            ->setPublic(true)
            ->replaceArgument(0, $map);

        if (isset($config['stream_wrapper'])) {
            $container->setParameter('knp_gaufrette.stream_wrapper.protocol', $config['stream_wrapper']['protocol']);
            $container->setParameter('knp_gaufrette.stream_wrapper.filesystems', $config['stream_wrapper']['filesystems']);
        }
    }
1096484
protected function loadInternal(array $configs, ContainerBuilder $container)
    {
        $parameters = $this->flattenParametersFromConfig($container, $configs, 'vm_pro_api');
        foreach ($parameters as $key => $value) {
            $container->setParameter($key, $value);
        }

        $loader = new YamlFileLoader(
            $container,
            new FileLocator(__DIR__.'/../Resources/config')
        );

        // Always load the services that will always be the same
        $loader->load('services/main.yml');

        // only load ratings service if the meta data fields are configured
        if (array_key_exists('vm_pro_api_rating_meta_data_fields_average', $parameters)
            && array_key_exists('vm_pro_api_rating_meta_data_fields_count', $parameters)) {
            $loader->load('services/ratings.yml');
        }

        // Dynamically load service configurations that are specific
        // to which Guzzle version is installed
        if (version_compare(ClientInterface::VERSION, '6.0', '>=')) {
            $loader->load('services/guzzle6.yml');
        } else {
            $loader->load('services/guzzle5.yml');
        }

        if (version_compare(Kernel::VERSION, '3.3', '>=')) {
            $loader->load('services/symfony3.yml');
        }
    }
1374151
public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        if (empty($config['rulesets'])) {
            unset($config['rulesets']);
        }

        // Extract slugify arguments from config
        $slugifyArguments = array_intersect_key($config, array_flip(['lowercase', 'trim', 'strip_tags', 'separator', 'regexp', 'rulesets']));

        $container->setDefinition('cocur_slugify', new Definition('Cocur\Slugify\Slugify', [$slugifyArguments]));
        $container
            ->setDefinition(
                'cocur_slugify.twig.slugify',
                new Definition(
                    'Cocur\Slugify\Bridge\Twig\SlugifyExtension',
                    [new Reference('cocur_slugify')]
                )
            )
            ->addTag('twig.extension')
            ->setPublic(false);
        $container->setAlias('slugify', 'cocur_slugify');

        // for symfony versions >= 3.3
        if (Kernel::VERSION_ID >= 30300) {
            $container->setAlias('Cocur\Slugify\SlugifyInterface', 'cocur_slugify');
        }
    }
1353242
public function load(array $configs, ContainerBuilder $container)
    {
        $processor = new Processor();

        $reflectionObject = new \ReflectionObject($this);
        $loader = new Loader\XmlFileLoader($container, new FileLocator(dirname($reflectionObject->getFileName()).'/../Resources/config'));

        $configuration = new Configuration();
        $config = $processor->processConfiguration($configuration, $configs);

        $parameterBuilder = new ParameterBuilder($container);
        $parameterBuilder->build(Constants::ROOT_PARAMETER, $config);

        $this->loadXmlServices($loader);

        if (Driver::BOTH === $container->getParameter(Constants::ROOT_PARAMETER.'.admin.driver')) {
            $container->setParameter(Constants::ROOT_PARAMETER.'.admin.backend_type_orm', true);
            $container->setParameter(Constants::ROOT_PARAMETER.'.admin.backend_type_odm', true);

            $loader->load('orm.xml');
            $loader->load('odm.xml');
        } else {
            $driver = $container->getParameter(Constants::ROOT_PARAMETER.'.admin.driver');
            $container->setParameter(Constants::ROOT_PARAMETER.'.admin.backend_type_'.$driver, true);

            $loader->load($driver.'.xml');
        }
    }
699984
public function load(array $configs, ContainerBuilder $container)
    {
        $container->setParameter('claro_cas_server_login_url', '');
        $container->setParameter('claro_cas_server_logout_url', '');
        $container->setParameter('claro_cas_server_validation_url', '');
        $locator = new FileLocator(__DIR__.'/../Resources/config');
        $loader = new YamlFileLoader($container, $locator);
        $loader->load('parameters.yml');
    }