Example #1
0
 public function load(array $configs, ContainerBuilder $container)
 {
     if (!array_filter($configs)) {
         return;
     }
     $processor = new Processor();
     // first assemble the factories
     $factories = $this->createListenerFactories($container, $processor->process($this->configuration->getFactoryConfigTree(), $configs));
     // normalize and merge the actual configuration
     $tree = $this->configuration->getMainConfigTree($factories);
     $config = $processor->process($tree, $configs);
     // load services
     $loader = new XmlFileLoader($container, new FileLocator(array(__DIR__ . '/../Resources/config', __DIR__ . '/Resources/config')));
     $loader->load('security.xml');
     $loader->load('security_listeners.xml');
     $loader->load('security_rememberme.xml');
     $loader->load('templating_php.xml');
     $loader->load('templating_twig.xml');
     $loader->load('collectors.xml');
     // set some global scalars
     $container->setParameter('security.access.denied_url', $config['access_denied_url']);
     $container->setParameter('security.authentication.session_strategy.strategy', $config['session_fixation_strategy']);
     $this->createFirewalls($config, $container);
     $this->createAuthorization($config, $container);
     $this->createRoleHierarchy($config, $container);
     if ($config['encoders']) {
         $this->createEncoders($config['encoders'], $container);
     }
     // load ACL
     if (isset($config['acl'])) {
         $this->aclLoad($config['acl'], $container);
     }
     // add some required classes for compilation
     $this->addClassesToCompile(array('Symfony\\Component\\Security\\Http\\Firewall', 'Symfony\\Component\\Security\\Http\\FirewallMapInterface', 'Symfony\\Component\\Security\\Core\\SecurityContext', 'Symfony\\Component\\Security\\Core\\SecurityContextInterface', 'Symfony\\Component\\Security\\Core\\User\\UserProviderInterface', 'Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationProviderManager', 'Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationManagerInterface', 'Symfony\\Component\\Security\\Core\\Authorization\\AccessDecisionManager', 'Symfony\\Component\\Security\\Core\\Authorization\\AccessDecisionManagerInterface', 'Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface', 'Symfony\\Bundle\\SecurityBundle\\Security\\FirewallMap', 'Symfony\\Bundle\\SecurityBundle\\Security\\FirewallContext', 'Symfony\\Component\\HttpFoundation\\RequestMatcher', 'Symfony\\Component\\HttpFoundation\\RequestMatcherInterface'));
 }
 function __construct(array $config, TreeBuilder $tree = null)
 {
     $processor = new Processor();
     $tree = $tree ?: ConfigTree::get();
     $config = ['bureaupieper_storee' => $config];
     parent::__construct($processor->process($tree->buildTree(), $config));
 }
    public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

        $processor     = new Processor();
        $configuration = new Configuration();

        $config = $processor->process($configuration->getConfigTree(), $configs);

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

        $container->setParameter('adyen.platform', $config['platform']);
        $container->setParameter('adyen.skin', $config['skin']);
        $container->setParameter('adyen.merchant_account', $config['merchant_account']);
        $container->setParameter('adyen.shared_secret', $config['shared_secret']);
        $container->setParameter('adyen.currency', $config['currency']);
        $container->setParameter('adyen.update_charge_amount', $config['update_charge_amount']);
        $container->setParameter('adyen.subscription_entity', $config['subscription_entity']);
        $container->setParameter('adyen.plan_entity', $config['plan_entity']);
        $container->setParameter('adyen.transaction_entity', $config['transaction_entity']);
        $container->setParameter('adyen.webservice_username', $config['webservice_username']);
        $container->setParameter('adyen.webservice_password', $config['webservice_password']);
        $container->setParameter('adyen.payment_methods', $config['payment_methods']);

        $container->setAlias('adyen.orm_entity_manager', new Alias($config['orm_entity_manager']));
    }
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $processor = new Processor();
     $config = $processor->process($configuration->getConfigTree(), $configs);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('config.xml');
     if (empty($config['clients']) || empty($config['indexes'])) {
         throw new InvalidArgumentException('You must define at least one client and one index');
     }
     if (empty($config['default_client'])) {
         $keys = array_keys($config['clients']);
         $config['default_client'] = reset($keys);
     }
     if (empty($config['default_index'])) {
         $keys = array_keys($config['indexes']);
         $config['default_index'] = reset($keys);
     }
     $clientIdsByName = $this->loadClients($config['clients'], $container);
     $indexIdsByName = $this->loadIndexes($config['indexes'], $container, $clientIdsByName, $config['default_client']);
     $indexDefsByName = array_map(function ($id) use($container) {
         return $container->getDefinition($id);
     }, $indexIdsByName);
     $this->loadIndexManager($indexDefsByName, $container->getDefinition($indexIdsByName[$config['default_index']]), $container);
     $this->loadReseter($this->indexConfigs, $container);
     $container->setAlias('foq_elastica.client', sprintf('foq_elastica.client.%s', $config['default_client']));
     $container->setAlias('foq_elastica.index', sprintf('foq_elastica.index.%s', $config['default_index']));
 }
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->process($configuration->getConfigTree(), $configs);
     $loader->load('services.xml');
     $annotationsToLoad = array();
     if ($config['router']['annotations']) {
         $annotationsToLoad[] = 'routing.xml';
     }
     if ($config['request']['converters']) {
         $annotationsToLoad[] = 'converters.xml';
     }
     if ($config['view']['annotations']) {
         $annotationsToLoad[] = 'view.xml';
     }
     if ($config['cache']['annotations']) {
         $annotationsToLoad[] = 'cache.xml';
     }
     if ($annotationsToLoad) {
         // must be first
         $loader->load('annotations.xml');
         foreach ($annotationsToLoad as $config) {
             $loader->load($config);
         }
     }
 }
Example #6
0
 /**
  * Responds to the twig configuration parameter.
  *
  * @param array            $configs
  * @param ContainerBuilder $container
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('twig.xml');
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->process($configuration->getConfigTree(), $configs);
     $container->setParameter('twig.form.resources', $config['form']['resources']);
     if (!empty($config['globals'])) {
         $def = $container->getDefinition('twig');
         foreach ($config['globals'] as $key => $global) {
             if (isset($global['type']) && 'service' === $global['type']) {
                 $def->addMethodCall('addGlobal', array($key, new Reference($global['id'])));
             } else {
                 $def->addMethodCall('addGlobal', array($key, $global['value']));
             }
         }
     }
     if (!empty($config['extensions'])) {
         foreach ($config['extensions'] as $id) {
             $container->getDefinition($id)->addTag('twig.extension');
         }
     }
     if (!empty($config['cache_warmer'])) {
         $container->getDefinition('templating.cache_warmer.templates_cache')->addTag('kernel.cache_warmer');
     }
     unset($config['form'], $config['globals'], $config['extensions'], $config['cache_warmer']);
     $container->setParameter('twig.options', $config);
     $this->addClassesToCompile(array('Twig_Environment', 'Twig_ExtensionInterface', 'Twig_Extension', 'Twig_Extension_Core', 'Twig_Extension_Escaper', 'Twig_Extension_Optimizer', 'Twig_LoaderInterface', 'Twig_Markup', 'Twig_TemplateInterface', 'Twig_Template'));
 }
Example #7
0
 /**
  * Loads the Monolog configuration.
  *
  * @param array            $config    An array of configuration settings
  * @param ContainerBuilder $container A ContainerBuilder instance
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $processor = new Processor();
     $config = $processor->process($configuration->getConfigTree(), $configs);
     if (isset($config['handlers'])) {
         $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
         $loader->load('monolog.xml');
         $container->setAlias('logger', 'monolog.logger');
         $logger = $container->getDefinition('monolog.logger_prototype');
         if (!empty($config['processors'])) {
             $this->addProcessors($logger, $config['processors']);
         }
         $handlers = array();
         foreach ($config['handlers'] as $name => $handler) {
             $handlers[] = $this->buildHandler($container, $name, $handler);
         }
         $handlers = array_reverse($handlers);
         foreach ($handlers as $handler) {
             if (!in_array($handler, $this->nestedHandlers)) {
                 $logger->addMethodCall('pushHandler', array(new Reference($handler)));
             }
         }
     }
     $this->addClassesToCompile(array('Monolog\\Formatter\\FormatterInterface', 'Monolog\\Formatter\\LineFormatter', 'Monolog\\Handler\\HandlerInterface', 'Monolog\\Handler\\AbstractHandler', 'Monolog\\Handler\\StreamHandler', 'Monolog\\Handler\\FingersCrossedHandler', 'Monolog\\Handler\\TestHandler', 'Monolog\\Logger', 'Symfony\\Bundle\\MonologBundle\\Logger\\Logger', 'Symfony\\Bundle\\MonologBundle\\Logger\\DebugHandler'));
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $configArgument = $input->getArgument('config');
     if (false === file_exists($configArgument)) {
         throw new FileNotFoundException(sprintf('configuration file : "%s" can not be found', $configArgument));
     }
     $output->write('1 - Parse config file : ');
     $parser = new Parser();
     $config = $parser->parse(file_get_contents($configArgument));
     unset($parser);
     $output->writeln('<info>Ok</info>');
     $output->write('2 - Load Resolver and Generators : ');
     $processor = new Processor();
     $workerConfiguration = $processor->process($this->configurationTree->getWorkerTree(), ['root' => $config]);
     $generators = $this->generatorChain->getGenerators($workerConfiguration['generators']);
     $resolvers = $this->resolverChain->getResolvers($workerConfiguration['resolvers']);
     $output->writeln('<info>Ok</info>');
     $output->write('3 - Build configuration tree : ');
     foreach (array_merge($generators, $resolvers) as $worker) {
         if ($worker instanceof TreeConfiguratorInterface) {
             $this->configurationTree->addTreeConfigurator($worker);
         }
     }
     $output->writeln('<info>Ok</info>');
     $dumper = new YamlReferenceDumper();
     echo $dumper->dump($this->configurationTree);
 }
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('blameable.xml');
     $config = $processor->process($configuration->getConfigTree(), $configs);
     if (isset($config['blameable']['user_class'])) {
         if (class_exists($config['blameable']['user_class'])) {
             $refClass = new \ReflectionClass($config['blameable']['user_class']);
             if ($refClass->newInstance() instanceof \Symfony\Component\Security\Core\User\UserInterface) {
                 $container->setParameter('pss.blameable.user_class', $config['blameable']['user_class']);
             } else {
                 throw new \InvalidArgumentException('User class must implements \\Symfony\\Component\\Security\\Core\\User\\UserInterface');
             }
         } else {
             throw new \InvalidArgumentException('Class doesn\'t exist.');
         }
     }
     if (isset($config['blameable']['store_object'])) {
         $container->setParameter('pss.blameable.store_object', $config['blameable']['store_object']);
     } else {
         $container->setParameter('pss.blameable.store_object', $config['blameable']['store_object']);
     }
     foreach ($config['blameable']['drivers'] as $name => $enable) {
         if ($enable) {
             if (isset($this->listenerTag[$name])) {
                 $container->getDefinition('pss.blameable.listener.' . $name)->addTag($this->listenerTag[$name]);
             } else {
                 throw new \InvalidArgumentException(printf('%s DB driver is not supported', $name));
             }
         }
     }
 }
Example #10
0
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->process($configuration->getConfigTree(), $configs);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('model.xml');
     $loader->load('provider.xml');
     $loader->load('sync.xml');
     $loader->load('messenger.xml');
     foreach ($config['feature'] as $feature => $enabled) {
         if ($enabled) {
             $loader->load($feature . '.xml');
         }
     }
     if ($config['feature']['ai']) {
         foreach (array('enabled', 'priority', 'executable_path', 'book_dir') as $option) {
             $container->setParameter('lichess.ai.crafty.' . $option, $config['ai']['crafty'][$option]);
         }
         foreach (array('enabled', 'priority') as $option) {
             $container->setParameter('lichess.ai.stupid.' . $option, $config['ai']['stupid'][$option]);
         }
     }
     $container->setParameter('lichess.debug_assets', $config['debug_assets']);
     $container->setParameter('lichess.sync.path', $config['sync']['path']);
     if ($config['test']) {
         $loader->load('test.xml');
     }
 }
Example #11
0
 /**
  * Loads the configuration.
  *
  * When the debug flag is true, files in an asset collections will be
  * rendered individually.
  *
  * In XML:
  *
  *     <assetic:config
  *         debug="true"
  *         use-controller="true"
  *         document-root="/path/to/document/root"
  *         closure="/path/to/google_closure/compiler.jar"
  *         yui="/path/to/yuicompressor.jar"
  *         default-javascripts-output="js/build/*.js"
  *         default-stylesheets-output="css/build/*.css"
  *     />
  *
  * In YAML:
  *
  *     assetic:
  *         debug: true
  *         use_controller: true
  *         document_root: /path/to/document/root
  *         closure: /path/to/google_closure/compiler.jar
  *         yui: /path/to/yuicompressor.jar
  *         default_javascripts_output: js/build/*.js
  *         default_stylesheets_output: css/build/*.css
  *
  * @param array            $configs   An array of configuration settings
  * @param ContainerBuilder $container A ContainerBuilder instance
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('assetic.xml');
     $loader->load('templating_twig.xml');
     // $loader->load('templating_php.xml'); // not ready yet
     $configuration = new Configuration();
     $processor = new Processor();
     $config = $processor->process($configuration->getConfigTree($container->getParameter('kernel.debug')), $configs);
     $container->setParameter('assetic.debug', $config['debug']);
     $container->setParameter('assetic.use_controller', $config['use_controller']);
     $container->setParameter('assetic.document_root', $config['document_root']);
     $container->setParameter('assetic.default_javascripts_output', $config['default_javascripts_output']);
     $container->setParameter('assetic.default_stylesheets_output', $config['default_stylesheets_output']);
     if (isset($config['closure'])) {
         $container->setParameter('assetic.google_closure_compiler_jar', $config['closure']);
         $loader->load('google_closure_compiler.xml');
     }
     if (isset($config['yui'])) {
         $container->setParameter('assetic.yui_jar', $config['yui']);
         $loader->load('yui_compressor.xml');
     }
     if ($container->getParameterBag()->resolveValue($container->getParameterBag()->get('assetic.use_controller'))) {
         $loader->load('controller.xml');
         $container->setParameter('assetic.twig_extension.class', '%assetic.twig_extension.dynamic.class%');
     } else {
         $loader->load('asset_writer.xml');
         $container->setParameter('assetic.twig_extension.class', '%assetic.twig_extension.static.class%');
     }
     if ($container->hasParameter('assetic.less.compress')) {
         $container->getDefinition('assetic.filter.less')->addMethodCall('setCompress', array('%assetic.less.compress%'));
     }
 }
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->processConfiguration($configuration, $configs);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $providers = $config['providers'];
     foreach ($providers as $key => $providerConfig) {
         // manually make sure "type" is there
         if (!isset($providerConfig['type'])) {
             throw new InvalidConfigurationException(sprintf('Your "knpu_oauth2_client.providers." config entry is missing the "type" key.', $key));
         }
         $type = $providerConfig['type'];
         unset($providerConfig['type']);
         if (!isset(self::$supportedProviderTypes[$type])) {
             throw new InvalidConfigurationException(sprintf('The "knpu_oauth2_client.providers" config "type" key "%s" is not supported. We support (%s)', $type, implode(', ', self::$supportedProviderTypes)));
         }
         // process the configuration
         $tree = new TreeBuilder();
         $node = $tree->root('knpu_oauth2_client/providers/' . $key);
         $this->buildConfigurationForType($node, $type);
         $processor = new Processor();
         $config = $processor->process($tree->buildTree(), array($providerConfig));
         $configurator = $this->getConfigurator($type);
         // hey, we should add the provider service!
         $this->configureProvider($container, $type, $key, $configurator->getProviderClass(), $configurator->getPackagistName(), $configurator->getProviderOptions($config), $config['redirect_route'], $config['redirect_params']);
     }
 }
 /**
  * Responds to the "mandango" configuration parameter.
  *
  * @param array            $configs
  * @param ContainerBuilder $container
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('mandango.xml');
     $processor = new Processor();
     $configuration = new Configuration($container->getParameter('kernel.debug'));
     $config = $processor->process($configuration->getConfigTree(), $configs);
     // model_dir
     if (isset($config['model_dir'])) {
         $container->setParameter('mandango.model_dir', $config['model_dir']);
     }
     // logging
     if (isset($config['logging']) && $config['logging']) {
         $container->getDefinition('mandango')->addArgument(array(new Reference('mandango.logger'), 'logQuery'));
     }
     // default_connection
     if (isset($config['default_connection'])) {
         $container->getDefinition('mandango')->addMethodCall('setDefaultConnectionName', array($config['default_connection']));
     }
     // extra config classes dirs
     $container->setParameter('mandango.extra_config_classes_dirs', $config['extra_config_classes_dirs']);
     // connections
     foreach ($config['connections'] as $name => $connection) {
         $definition = new Definition($connection['class'], array($connection['server'], $connection['database'], $connection['options']));
         $connectionDefinitionName = sprintf('mandango.%s_connection', $name);
         $container->setDefinition($connectionDefinitionName, $definition);
         // ->setConnection
         $container->getDefinition('mandango')->addMethodCall('setConnection', array($name, new Reference($connectionDefinitionName)));
     }
 }
 /**
  * Responds to the doctrine_mongo_db configuration parameter.
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     // Load DoctrineMongoDBBundle/Resources/config/mongodb.xml
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('mongodb.xml');
     $processor = new Processor();
     $configuration = new Configuration($container->getParameter('kernel.debug'));
     $config = $processor->process($configuration->getConfigTree(), $configs);
     // can't currently default this correctly in Configuration
     if (!isset($config['metadata_cache_driver'])) {
         $config['metadata_cache_driver'] = array('type' => 'array');
     }
     if (empty($config['default_connection'])) {
         $keys = array_keys($config['connections']);
         $config['default_connection'] = reset($keys);
     }
     if (empty($config['default_document_manager'])) {
         $keys = array_keys($config['document_managers']);
         $config['default_document_manager'] = reset($keys);
     }
     // set some options as parameters and unset them
     $config = $this->overrideParameters($config, $container);
     // load the connections
     $this->loadConnections($config['connections'], $container);
     // load the document managers
     $this->loadDocumentManagers($config['document_managers'], $config['default_document_manager'], $config['default_database'], $config['metadata_cache_driver'], $container);
     $this->loadConstraints($container);
 }
 /**
  * Loads the extension.
  * 
  * @param array $configs The configuration
  * @param ContainerBuilder $container The container builder
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->process($configuration->getConfigTree(), $configs);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $toLoad = array('query.xml', 'services.xml', 'listener.xml');
     foreach ($toLoad as $file) {
         $loader->load($file);
     }
     $container->setParameter('vich_geographical.query_service.class', $config['class']['query_service']);
     $listenerName = 'vich_geographical.listener.geographical';
     foreach ($config['orm'] as $name => $params) {
         if ($params['enabled']) {
             $definition = $container->getDefinition($listenerName);
             $definition->addTag('doctrine.event_subscriber', array('connection' => $name));
         }
         $this->entityManagers[] = $name;
     }
     if ($config['twig']['enabled']) {
         $loader->load('twig.xml');
     }
     $rendererOptions = array();
     if (null !== $config['leaflet']['api_key']) {
         $rendererOptions['leaflet_api_key'] = $config['leaflet']['api_key'];
     }
     if (null !== $config['bing']['api_key']) {
         $rendererOptions['bing_api_key'] = $config['bing']['api_key'];
     }
     $container->setParameter('vich_geographical.map_renderer.options', $rendererOptions);
     $container->setParameter('vich_geographical.map_renderer.class', $config['class']['map_renderer']);
 }
Example #16
0
 protected static function processConfigs(array $configs, $debug, array $bundles)
 {
     $configuration = new Configuration();
     $tree = $configuration->getConfigTree($debug, $bundles);
     $processor = new Processor();
     return $processor->process($tree, $configs);
 }
 public function testCustomConfiguration()
 {
     $configuration = new Configuration();
     $processor = new Processor();
     $config = $processor->process($configuration->getConfigTreeBuilder()->buildTree(), array('akeneo_batch' => array('sender_email' => '*****@*****.**')));
     $this->assertEquals('*****@*****.**', $config['sender_email']);
 }
 /**
  * Responds to the "white_october_admin" configuration parameter.
  *
  * @param array            $configs
  * @param ContainerBuilder $container
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('admin.xml');
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->process($configuration->getConfigTree(), $configs);
     // data managers
     if (!empty($config['data_managers']['mandango'])) {
         $loader->load('data_manager_mandango.xml');
     }
     if (!empty($config['data_managers']['doctrine']['orm'])) {
         $loader->load('data_manager_doctrine_orm.xml');
     }
     if (!empty($config['data_managers']['doctrine']['odm'])) {
         $loader->load('data_manager_doctrine_odm.xml');
     }
     // admins
     $adminIds = array();
     foreach ($config['admins'] as $admin) {
         $definition = new Definition($admin['class']);
         $definition->addMethodCall('setContainer', array(new Reference('service_container')));
         $classId = str_replace('\\', '_', $admin['class']);
         $adminId = 'white_october_admin.admin.' . $classId;
         $container->setDefinition($adminId, $definition);
         $adminIds[] = $adminId;
     }
     $container->getDefinition('white_october_admin.admin_factory')->replaceArgument(0, $adminIds);
 }
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->process($configuration->getConfigTree(), $configs);
     $container->setParameter('sixdays_opcache.base_url', $config['base_url']);
     $container->setParameter('sixdays_opcache.web_dir', $config['web_dir']);
 }
 /**
  * @param array $config
  *
  * @return array
  */
 protected function processConfig(array $config)
 {
     $processor = new Processor();
     if (!$this->jobTemplateConfig) {
         $this->jobTemplateConfig = $this->getJobTemplatesConfigTree();
     }
     return $processor->process($this->jobTemplateConfig, $config);
 }
 public function testGetConfigTreeBuilder()
 {
     $config = Yaml::parse(file_get_contents(__DIR__ . '/Fixtures/config.yml'));
     $configuration = new Configuration();
     $treeBuilder = $configuration->getConfigTreeBuilder();
     $processor = new Processor();
     $config = $processor->process($treeBuilder->buildTree(), $config);
 }
 /**
  * @dataProvider configValueProvider
  */
 public function testConfigure($mode)
 {
     $configurationTree = new ConfigurationTree();
     $tree = $configurationTree->getConfigTree(array(new DeprecationExtension()));
     $processor = new Processor();
     $config = $processor->process($tree, array('testwork' => array('caciobanu_deprecation_extension' => array('mode' => $mode))));
     $this->assertEquals(array('caciobanu_deprecation_extension' => array('mode' => $mode)), $config);
 }
 protected function processNode(NodeDefinition $definition, array $config, $sectionName = true)
 {
     $processor = new Processor();
     $node = $definition->getNode(true);
     if ($sectionName) {
         $config = [$node->getName() => $config];
     }
     return $processor->process($node, $config);
 }
 /**
  * Responds to the twig configuration parameter.
  *
  * @param array            $configs
  * @param ContainerBuilder $container
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->process($configuration->getConfigTree(), $configs);
     foreach ($config as $key => $value) {
         $container->setParameter($this->getAlias() . '.' . $key, $value);
     }
 }
 /**
  * @test
  *
  * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
  * @expectedExceptionMessage The child node "options" at path "foo" must be configured.
  */
 public function thrownIfOptionsSectionMissing()
 {
     $factory = new OmnipayOffsiteGatewayFactory();
     $tb = new TreeBuilder();
     $rootNode = $tb->root('foo');
     $factory->addConfiguration($rootNode);
     $processor = new Processor();
     $processor->process($tb->buildTree(), array(array('type' => 'PayPal_Express')));
 }
Example #26
0
 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $this->loadDefaults($container);
     // normalize and merge the actual configuration
     $tree = $this->configuration->getConfigTree();
     $config = $this->processor->process($tree, $configs);
     // load configs DIC
     foreach ($config as $ns => $subconfig) {
         foreach ($subconfig as $key => $value) {
             if ('filters' === $ns) {
                 $parameterName = "gherkin.{$ns}.{$key}";
             } else {
                 $parameterName = "behat.{$ns}.{$key}";
             }
             $container->setParameter($parameterName, $value);
         }
     }
 }
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $processor = new Processor();
     $config = $processor->process($this->getConfigTree(), $configs);
     $container->setParameter('jms.debugging.debug', $config['debug']);
     $container->setParameter('jms.debugging.auto_help', $config['auto_help']);
 }
 /**
  * @param array            $configs
  * @param ContainerBuilder $container
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new YamlFileLoader($container, new FileLocator(array(__DIR__ . '/../Resources/config')));
     $loader->load('services.yml');
     $configuration = new Configuration();
     $processor = new Processor();
     $config = $processor->process($configuration->getConfigTreeBuilder(), $configs);
     $container->getDefinition('opcvm360.api')->addArgument($config['login'])->addArgument($config['password'])->addArgument($config['base_url']);
 }
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(array(__DIR__ . '/../Resources/config')));
     $loader->load('config.xml');
     $configuration = new Configuration();
     $processor = new Processor();
     $config = $processor->process($configuration->getConfigTree(), $configs);
     $container->getDefinition('gravatar.api')->addArgument($config);
 }
 /**
  * @test
  *
  * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
  * @expectedExceptionMessage The child node "password" at path "foo" must be configured.
  */
 public function thrownIfPasswordOptionNotSet()
 {
     $factory = new Be2BillDirectGatewayFactory();
     $tb = new TreeBuilder();
     $rootNode = $tb->root('foo');
     $factory->addConfiguration($rootNode);
     $processor = new Processor();
     $processor->process($tb->buildTree(), array(array('identifier' => 'anIdentifier')));
 }