/**
     * Loads the extension
     *
     * @param  array            $configs
     * @param  ContainerBuilder $container
     */
    public function load(array $configs, ContainerBuilder $container)
    {
        $processor = new Processor();

        // first assemble the adapter factories
        $factoryConfig = new FactoryConfiguration();
        $config        = $processor->processConfiguration($factoryConfig, $configs);
        $factories     = $this->createAdapterFactories($config, $container);

        // then normalize the configs
        $mainConfig = new MainConfiguration($factories);
        $config     = $processor->processConfiguration($mainConfig, $configs);

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

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

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

        $container->getDefinition('knp_gaufrette.filesystem_map')
            ->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']);
        }
    }
示例#2
0
 /**
  * @param Suite $suite
  * @param string $listenerName
  * @param array $listenerAttributes
  */
 private function addListenerToSuite(Suite $suite, $listenerName, array $listenerAttributes)
 {
     Assert::keyExists($listenerAttributes, 'options');
     $listener = $this->listenerRegistry->getListener($listenerName);
     $listenerOptions = $this->optionsProcessor->processConfiguration($listener, $listenerAttributes['options']);
     $listenerPriority = isset($listenerAttributes['priority']) ? $listenerAttributes['priority'] : 0;
     $suite->addListener($listener, $listenerOptions, $listenerPriority);
 }
 function it_parse_configs()
 {
     $configuration = new Configuration();
     $processor = new Processor();
     $configs = $processor->processConfiguration($configuration, $this->configs);
     $parsedConfigs = $processor->processConfiguration($configuration, array($this->parsedConfigs));
     $this->parseConfig($configs)->shouldReturn($parsedConfigs);
 }
 /**
  * Loads the linter configuration.
  *
  * @param string                                             $configurationFile The configuration file to load from.
  *                                                                              This file will be searched in the
  *                                                                              current working directory and in
  *                                                                              the tslint root directory. Contents
  *                                                                              from the file will also be merged
  *                                                                              with the tslint.dist.yml file in
  *                                                                              the tslint root directory.
  * @param \Helmich\TypoScriptLint\Linter\LinterConfiguration $configuration     The configuration on which to set
  *                                                                              the loaded configuration values.
  * @return \Helmich\TypoScriptLint\Linter\LinterConfiguration The linter configuration from the given configuration file.
  */
 public function loadConfiguration($configurationFile = NULL, LinterConfiguration $configuration = NULL)
 {
     $distConfig = $this->loader->load('tslint.dist.yml');
     $localConfig = $configurationFile ? $this->loader->load($configurationFile) : [];
     $configuration = $configuration ?: new LinterConfiguration();
     $processedConfiguration = $this->processor->processConfiguration($configuration, [$distConfig, $localConfig]);
     $configuration->setConfiguration($processedConfiguration);
     return $configuration;
 }
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $processor = new Processor();
     $config = $processor->processConfiguration($configuration, $configs);
     $processor->processConfiguration($configuration, $configs);
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
 }
示例#6
0
 public function getDefinition(NamedConfigInterface $configurator)
 {
     $type = $configurator->getType();
     // returns the cached version of the configuration
     if (!empty($this->definitions[$type])) {
         return $this->definitions[$type];
     }
     // process and validate the configuration
     $processedConfiguration = $this->processor->processConfiguration($configurator, $this->config);
     $this->definitions[$type] = $processedConfiguration;
     return $this->definitions[$type];
 }
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config/'));
     $loader->load('services.yml');
     $loader->load('owners.yml');
     $processor = new Processor();
     $config = $processor->processConfiguration(new Configuration(), $configs);
     $container->getDefinition('glory_oauth.oauth_manager')->addMethodCall('setOAuthClass', array($config['oauth_class']));
     // setup http client settings
     $httpClient = $container->getDefinition('glory_oauth.http_client');
     $httpClient->addMethodCall('setVerifyPeer', array($config['http_client']['verify_peer']));
     $httpClient->addMethodCall('setTimeout', array($config['http_client']['timeout']));
     $httpClient->addMethodCall('setMaxRedirects', array($config['http_client']['max_redirects']));
     $httpClient->addMethodCall('setIgnoreErrors', array($config['http_client']['ignore_errors']));
     if (isset($config['http_client']['proxy']) && $config['http_client']['proxy'] != '') {
         $httpClient->addMethodCall('setProxy', array($config['http_client']['proxy']));
     }
     // setup services for all configured resource owners
     foreach ($config['owners'] as $name => $options) {
         $this->createOwnerService($container, $name, $options);
     }
     // check of the connect controllers etc should be enabled
     $container->setParameter('glory_oauth.auto_register', $config['auto_register']);
     $container->setAlias('glory_oauth.connect', $config['connect']);
 }
示例#8
0
 /**
  * @dataProvider getDebugModes
  */
 public function testConfigTree($options, $results)
 {
     $processor = new Processor();
     $configuration = new Configuration(array());
     $config = $processor->processConfiguration($configuration, array($options));
     $this->assertEquals($results, $config);
 }
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $config = $processor->processConfiguration(new Configuration(), $configs);
     $loader = new XmlFileLoader($container, new FileLocator(array(__DIR__ . '/../Resources/config')));
     $loader->load('services.xml');
     $container->setParameter('jms_i18n_routing.default_locale', $config['default_locale']);
     $container->setParameter('jms_i18n_routing.locales', $config['locales']);
     $container->setParameter('jms_i18n_routing.catalogue', $config['catalogue']);
     $container->setParameter('jms_i18n_routing.strategy', $config['strategy']);
     $this->addClassesToCompile(array($container->getDefinition('jms_i18n_routing.router')->getClass()));
     if ('prefix' === $config['strategy']) {
         $container->getDefinition('jms_i18n_routing.locale_choosing_listener')->setPublic(true)->addTag('kernel.event_listener', array('event' => 'kernel.exception', 'priority' => 128));
     }
     if ($config['hosts']) {
         $container->getDefinition('jms_i18n_routing.router')->addMethodCall('setHostMap', array($config['hosts']));
         $container->getDefinition('jms_i18n_routing.locale_changing_listener')->setPublic(true)->addTag('kernel.event_listener', array('event' => 'kernel.request', 'priority' => 120))->addArgument(array_flip($config['hosts']));
         $this->addClassesToCompile(array($container->getDefinition('jms_i18n_routing.locale_changing_listener')->getClass()));
     }
     // remove route extractor if JMSTranslationBundle is not enabled to avoid any problems
     $bundles = $container->getParameter('kernel.bundles');
     if (!isset($bundles['JMSTranslationBundle'])) {
         $container->removeDefinition('jms_i18n_routing.route_translation_extractor');
     }
 }
示例#10
0
 function __construct($configFile)
 {
     $yaml = new Parser();
     $config = $yaml->parse(file_get_contents($configFile));
     $processor = new Processor();
     $this->config = $processor->processConfiguration(new Schema(), $config);
 }
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     // first assemble the adapter factories
     $factoriesConfig = new FactoriesConfiguration();
     $config = $processor->processConfiguration($factoriesConfig, $configs);
     $factories = $this->createProviderFactories($config, $container);
     // then handle to main configuration part
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     // then check the providers configuration
     $providersConfig = new ProvidersConfiguration($config['providers'], $factories);
     $providersConfig = $this->processConfiguration($providersConfig, $configs);
     // and now, create the providers required by the configuration
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $loader->load('providers.xml');
     // start fixing providers definitions
     $definition = $container->getDefinition('sms.sender');
     foreach ($config['providers'] as $provider) {
         $id = $this->createProvider($provider, $factories, $container, $providersConfig);
         // also register it to the main sms.sender service
         $definition->addMethodCall('registerProvider', array(new Reference($id)));
     }
     // fix the sms.http_adapter definition to point to the right adapter
     $container->setAlias('sms.http_adapter', sprintf('sms.http_adapter.%s', $config['http_adapter']));
     $container->getAlias('sms.http_adapter')->setPublic(false);
     // define an alias to the real pooling service (will be used by the compiler pass)
     if ($config['pool'] !== null) {
         $container->setAlias('sms.pool', sprintf('sms.pool.%s', $config['pool']));
     }
 }
示例#12
0
 /**
  * Load configuration.
  */
 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');
     $loader->load('controllers.xml');
     if (isset($config['serializer'])) {
         $container->setAlias('fos_js_routing.serializer', new Alias($config['serializer'], false));
     } else {
         $loader->load('serializer.xml');
     }
     $container->setAlias('fos_js_routing.router', new Alias($config['router'], false));
     $container->getDefinition('fos_js_routing.extractor')->replaceArgument(1, $config['routes_to_expose']);
     if (isset($config['request_context_base_url'])) {
         $container->setParameter('fos_js_routing.request_context_base_url', $config['request_context_base_url']);
     }
     if (isset($config['cache_control'])) {
         $config['cache_control']['enabled'] = true;
     } else {
         $config['cache_control'] = array('enabled' => false);
     }
     $container->setParameter('fos_js_routing.cache_control', $config['cache_control']);
 }
示例#13
0
 public function testExtensions()
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->processConfiguration($configuration, [['extensions' => [['route' => 'test_route', 'label' => 'Foo Extension', 'icon' => 'bar']]]]);
     $this->assertEquals([['route' => 'test_route', 'label' => 'Foo Extension', 'role' => 'ROLE_ADMIN', 'icon' => 'bar']], $config['extensions']);
 }
 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->processConfiguration($configuration, $configs);
     $container->setParameter('nelmio_api_doc.motd.template', $config['motd']['template']);
     $container->setParameter('nelmio_api_doc.exclude_sections', $config['exclude_sections']);
     $container->setParameter('nelmio_api_doc.api_name', $config['name']);
     $container->setParameter('nelmio_api_doc.sandbox.enabled', $config['sandbox']['enabled']);
     $container->setParameter('nelmio_api_doc.sandbox.endpoint', $config['sandbox']['endpoint']);
     $container->setParameter('nelmio_api_doc.sandbox.accept_type', $config['sandbox']['accept_type']);
     $container->setParameter('nelmio_api_doc.sandbox.body_format.formats', $config['sandbox']['body_format']['formats']);
     $container->setParameter('nelmio_api_doc.sandbox.body_format.default_format', $config['sandbox']['body_format']['default_format']);
     $container->setParameter('nelmio_api_doc.sandbox.request_format.method', $config['sandbox']['request_format']['method']);
     $container->setParameter('nelmio_api_doc.sandbox.request_format.default_format', $config['sandbox']['request_format']['default_format']);
     $container->setParameter('nelmio_api_doc.sandbox.request_format.formats', $config['sandbox']['request_format']['formats']);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('formatters.xml');
     $loader->load('services.xml');
     if ($config['request_listener']['enabled']) {
         $container->setParameter('nelmio_api_doc.request_listener.parameter', $config['request_listener']['parameter']);
         $loader->load('request_listener.xml');
     }
     if (isset($config['sandbox']['authentication'])) {
         $container->setParameter('nelmio_api_doc.sandbox.authentication', $config['sandbox']['authentication']);
     }
     // backwards compatibility for Symfony2.1 https://github.com/nelmio/NelmioApiDocBundle/issues/231
     if (!interface_exists('\\Symfony\\Component\\Validator\\MetadataFactoryInterface')) {
         $container->setParameter('nelmio_api_doc.parser.validation_parser.class', 'Nelmio\\ApiDocBundle\\Parser\\ValidationParserLegacy');
     }
 }
示例#15
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output = new SymfonyStyle($input, $output);
     if (false !== strpos($input->getFirstArgument(), ':d')) {
         $output->caution('The use of "config:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:config" instead.');
     }
     $name = $input->getArgument('name');
     if (empty($name)) {
         $output->comment('Provide the name of a bundle as the first argument of this command to dump its configuration.');
         $output->newLine();
         $this->listBundles($output);
         return;
     }
     $extension = $this->findExtension($name);
     $container = $this->compileContainer();
     $configs = $container->getExtensionConfig($extension->getAlias());
     $configuration = $extension->getConfiguration($configs, $container);
     $this->validateConfiguration($extension, $configuration);
     $configs = $container->getParameterBag()->resolveValue($configs);
     $processor = new Processor();
     $config = $processor->processConfiguration($configuration, $configs);
     if ($name === $extension->getAlias()) {
         $output->title(sprintf('Current configuration for extension with alias "%s"', $name));
     } else {
         $output->title(sprintf('Current configuration for "%s"', $name));
     }
     $output->writeln(Yaml::dump(array($extension->getAlias() => $config), 3));
 }
 /**
  * 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->processConfiguration($configuration, $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);
 }
示例#17
0
 /**
  * {@inheritdoc}
  */
 public function load(array $config, ContainerBuilder $container)
 {
     $processor = new Processor();
     $config = $processor->processConfiguration(new Configuration(), $config);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $configFiles = ['services.xml', 'controller.xml', 'storage.xml', 'routing.xml', 'twig.xml'];
     foreach ($configFiles as $configFile) {
         $loader->load($configFile);
     }
     foreach ($config['resources'] as $alias => $resourceConfig) {
         $metadata = Metadata::fromAliasAndConfiguration($alias, $resourceConfig);
         $resources = $container->hasParameter('sylius.resources') ? $container->getParameter('sylius.resources') : [];
         $resources = array_merge($resources, [$alias => $resourceConfig]);
         $container->setParameter('sylius.resources', $resources);
         DriverProvider::get($metadata)->load($container, $metadata);
         if ($metadata->hasParameter('translation') && class_exists(SyliusTranslationBundle::class)) {
             $alias = $alias . '_translation';
             $resourceConfig = array_merge(['driver' => $resourceConfig['driver']], $resourceConfig['translation']);
             $resources = $container->hasParameter('sylius.resources') ? $container->getParameter('sylius.resources') : [];
             $resources = array_merge($resources, [$alias => $resourceConfig]);
             $container->setParameter('sylius.resources', $resources);
             $metadata = Metadata::fromAliasAndConfiguration($alias, $resourceConfig);
             DriverProvider::get($metadata)->load($container, $metadata);
         }
     }
     $container->setParameter('sylius.resource.settings', $config['settings']);
 }
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $processor = new Processor();
     $configuration = new Configuration();
     // merges the configs 1 array key into 0 array key - 1 is from the dev settings
     if (isset($configs[1])) {
         $configs = array(0 => array_merge($configs[0], $configs[1]));
     }
     if (isset($configs[0]['formatting'])) {
         $configs[0]['compilerFlags'][] = sprintf("--formatting=%s", $configs[0]['formatting']);
         unset($configs[0]['formatting']);
     }
     if (isset($configs[0]['debug'])) {
         $configs[0]['compilerFlags'][] = sprintf("--define='goog.DEBUG=%s'", $configs[0]['debug'] === TRUE ? 'true' : 'false');
         unset($configs[0]['debug']);
     } else {
         $configs[0]['compilerFlags'][] = sprintf("--define='goog.DEBUG=%s'", 'false');
     }
     if (isset($configs[0]['debugOutput'])) {
         $configs[0]['compilerFlags'][] = sprintf("--debug=%s", $configs[0]['debugOutput'] === TRUE ? 'true' : 'false');
         unset($configs[0]['debugOutput']);
     } else {
         $configs[0]['compilerFlags'][] = sprintf("--debug=%s", 'false');
     }
     $config = $processor->processConfiguration($configuration, $configs);
     $container->setParameter('platinum_pixs_google_closure_library.outputMode', $config['outputMode']);
     $container->setParameter('platinum_pixs_google_closure_library.compilerFlags', $config['compilerFlags']);
     $container->setParameter('platinum_pixs_google_closure_library.externs', $config['externs']);
     $container->setParameter('platinum_pixs_google_closure_library.root', $config['root']);
 }
示例#19
0
 /**
  * @param array $phphookerConfig
  * @param array $expectedConfig
  *
  * @dataProvider configurationProvider
  */
 public function testProcessConfiguration(array $phphookerConfig, array $expectedConfig)
 {
     $configuration = new Configuration();
     $processor = new Processor();
     $returnedConfig = $processor->processConfiguration($configuration, ['phphooker' => $phphookerConfig]);
     $this->assertEquals($expectedConfig, $returnedConfig);
 }
 public function __construct(ContainerInterface $container, array $config)
 {
     $this->container = $container;
     $processor = new Processor();
     $configuration = new MappedContainerHandlerProviderConfiguration();
     $this->config = $processor->processConfiguration($configuration, [$config]);
 }
 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration($container->getParameter('kernel.debug'));
     $config = $processor->processConfiguration($configuration, $configs);
     $this->loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $this->loader->load('phpcr.xml');
     if (!empty($config['manager_registry_service_id'])) {
         $container->setAlias('doctrine_phpcr', new Alias($config['manager_registry_service_id']));
     }
     $parameters = array('workspace_dir', 'jackrabbit_jar', 'dump_max_line_length');
     foreach ($parameters as $param) {
         if (isset($config[$param])) {
             $container->setParameter('doctrine_phpcr.' . $param, $config[$param]);
         }
     }
     if (!empty($config['session'])) {
         $this->sessionLoad($config['session'], $container);
     }
     if (!empty($config['odm'])) {
         if (empty($this->sessions)) {
             throw new InvalidArgumentException('You did not configure a session for the document managers');
         }
         $this->loadOdm($config['odm'], $container);
         if ($this->disableProxyWarmer) {
             $container->removeDefinition('doctrine_phpcr.odm.proxy_cache_warmer');
         }
     }
     $this->loadTypeGuess($config, $container);
 }
示例#22
0
 /**
  * {@inheritdoc}
  */
 public function parse($value, ManagerRegistry $doctrine)
 {
     if (!is_array($value)) {
         $value = Yaml::parse($value);
     }
     $processor = new Processor();
     $value = $processor->processConfiguration(new QueryConfiguration(), $value);
     if (!isset($value['from'])) {
         throw new InvalidConfigurationException('Missing mandatory "from" section');
     }
     $qb = $this->createQueryBuilder($doctrine, $value);
     foreach ((array) $value['from'] as $from) {
         $qb->from($from['table'], $from['alias']);
     }
     if (isset($value['select'])) {
         foreach ($value['select'] as $select) {
             $qb->add('select', new Expr\Select($select), true);
         }
     }
     if (isset($value['distinct'])) {
         $qb->distinct((bool) $value['distinct']);
     }
     $groupByFields = $this->getGroupByFields($value);
     if ($groupByFields) {
         $qb->groupBy(implode(',', $groupByFields));
     }
     if (isset($value['having'])) {
         $qb->having($value['having']);
     }
     $this->addJoin($qb, $value);
     $this->addWhere($qb, $value);
     $this->addOrder($qb, $value);
     return $qb;
 }
示例#23
0
 public function testSingleClientConfigWithOptions()
 {
     $config = ['guzzle' => ['clients' => ['test_client' => ['base_url' => 'http://baseurl/path', 'headers' => ['Accept' => 'application/json'], 'options' => ['cert' => 'path/to/cert', 'connect_timeout' => 5, 'debug' => false, 'decode_content' => true, 'delay' => 1, 'http_errors' => false, 'expect' => true, 'ssl_key' => 'key', 'stream' => true, 'synchronous' => true, 'timeout' => 30, 'verify' => true, 'version' => '1.1'], 'plugin' => ['wsse' => ['username' => 'user', 'password' => 'pass']]]]]];
     $processor = new Processor();
     $processedConfig = $processor->processConfiguration(new Configuration(true), $config);
     $this->assertEquals(array_merge($config['guzzle'], ['logging' => false]), $processedConfig);
 }
 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']);
     }
 }
示例#25
0
 public function testOptions()
 {
     $processor = new Processor();
     $config = $processor->processConfiguration(new Configuration(), array(array('default_contexts' => array('cms'))));
     $expected = array('default_contexts' => array(0 => 'cms'), 'profiler' => array('enabled' => '%kernel.debug%', 'template' => 'SonataBlockBundle:Profiler:block.html.twig', 'container_types' => array(0 => 'sonata.block.service.container', 1 => 'sonata.page.block.container', 2 => 'cmf.block.container', 3 => 'cmf.block.slideshow')), 'context_manager' => 'sonata.block.context_manager.default', 'http_cache' => array('handler' => 'sonata.block.cache.handler.default', 'listener' => true), 'templates' => array('block_base' => NULL, 'block_container' => NULL), 'blocks' => array(), 'menus' => array(), 'blocks_by_class' => array(), 'exception' => array('default' => array('filter' => 'debug_only', 'renderer' => 'throw'), 'filters' => array('debug_only' => 'sonata.block.exception.filter.debug_only', 'ignore_block_exception' => 'sonata.block.exception.filter.ignore_block_exception', 'keep_all' => 'sonata.block.exception.filter.keep_all', 'keep_none' => 'sonata.block.exception.filter.keep_none'), 'renderers' => array('inline' => 'sonata.block.exception.renderer.inline', 'inline_debug' => 'sonata.block.exception.renderer.inline_debug', 'throw' => 'sonata.block.exception.renderer.throw')));
     $this->assertEquals($expected, $config);
 }
 /**
  * Loads the url shortener configuration.
  *
  * @param array            $configs   An array of configuration settings
  * @param ContainerBuilder $container A ContainerBuilder instance
  */
 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('cache.xml');
     $loader->load('counter.xml');
     $useOrm = 'auto' == $config['cache_invalidation']['orm_listener'] ? class_exists('Doctrine\\ORM\\Version') : $config['cache_invalidation']['orm_listener'];
     if ($useOrm) {
         $loader->load('orm.xml');
     }
     $usePhpcrOdm = 'auto' == $config['cache_invalidation']['phpcr_odm_listener'] ? class_exists('Doctrine\\PHPCR\\ODM\\Version') : $config['cache_invalidation']['phpcr_odm_listener'];
     if ($usePhpcrOdm) {
         $loader->load('phpcr_odm.xml');
     }
     $this->configureInvalidation($container, $config);
     if ($useOrm) {
         $this->configureORM($container, $config);
     }
     if ($usePhpcrOdm) {
         $this->configurePHPCRODM($container, $config);
     }
     $this->configureCache($container, $config);
     $this->configureCounter($container, $config);
 }
示例#27
0
 /**
  * Validate the configuration file
  *
  * @param InputInterface  $input  An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  *
  * @return null
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->iohandler_factory->set_environment('cli');
     /** @var \phpbb\install\helper\iohandler\cli_iohandler $iohandler */
     $iohandler = $this->iohandler_factory->get();
     $style = new SymfonyStyle($input, $output);
     $iohandler->set_style($style, $output);
     $config_file = $input->getArgument('config-file');
     if (!is_file($config_file)) {
         $iohandler->add_error_message(array('MISSING_FILE', array($config_file)));
         return 1;
     }
     try {
         $config = Yaml::parse(file_get_contents($config_file), true, false);
     } catch (ParseException $e) {
         $iohandler->add_error_message('INVALID_YAML_FILE');
         return 1;
     }
     $processor = new Processor();
     $configuration = new updater_configuration();
     try {
         $processor->processConfiguration($configuration, $config);
     } catch (Exception $e) {
         $iohandler->add_error_message('INVALID_CONFIGURATION', $e->getMessage());
         return 1;
     }
     $iohandler->add_success_message('CONFIGURATION_VALID');
     return 0;
 }
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('auto_route.xml');
     $loader->load('token_providers.xml');
     $loader->load('defunct_route_handlers.xml');
     $loader->load('conflict_resolvers.xml');
     $config = $processor->processConfiguration($configuration, $configs);
     $resources = array();
     // auto mapping
     if ($config['auto_mapping']) {
         $bundles = $container->getParameter('kernel.bundles');
         $resources = $this->findMappingFiles($bundles);
     }
     // add configured mapping file resources
     if (isset($config['mapping']['resources'])) {
         foreach ($config['mapping']['resources'] as $resource) {
             $resources[] = $resource;
         }
     }
     $container->setParameter('cmf_routing_auto.metadata.loader.resources', $resources);
     $hasProvider = false;
     if ($this->isConfigEnabled($container, $config['persistence']['phpcr'])) {
         $hasProvider = true;
         $loader->load('phpcr-odm.xml');
         $container->setParameter('cmf_routing_auto.persistence.phpcr.route_basepath', $config['persistence']['phpcr']['route_basepath']);
     }
     if (!$hasProvider) {
         throw new InvalidConfigurationException('The RoutingAUtoBundle requires that you enable one of the persistence layers in your application configuration. ' . 'See the documentation for more information');
     }
 }
 public function testDoNoDuplicateDefaultFormResources()
 {
     $input = array('form_themes' => array('form_div_layout.html.twig'));
     $processor = new Processor();
     $config = $processor->processConfiguration(new Configuration(), array($input));
     $this->assertEquals(array('form_div_layout.html.twig'), $config['form_themes']);
 }
 /**
  * {@inheritdoc}
  */
 public function parse($value, QueryBuilder $qb)
 {
     if (!is_array($value)) {
         $value = Yaml::parse($value);
     }
     $processor = new Processor();
     $value = $processor->processConfiguration(new QueryConfiguration(), $value);
     if (!isset($value['from'])) {
         throw new \RuntimeException('Missing mandatory "from" section');
     }
     foreach ((array) $value['from'] as $from) {
         $qb->from($from['table'], $from['alias']);
     }
     if (isset($value['select'])) {
         foreach ($value['select'] as $select) {
             $qb->add('select', new Expr\Select($select), true);
         }
     }
     if (isset($value['distinct'])) {
         $qb->distinct((bool) $value['distinct']);
     }
     if (isset($value['groupBy'])) {
         $qb->groupBy($value['groupBy']);
     }
     if (isset($value['having'])) {
         $qb->having($value['having']);
     }
     $this->addJoin($qb, $value);
     $this->addWhere($qb, $value);
     $this->addOrder($qb, $value);
     return $qb;
 }