当前位置: 首页>>代码示例>>PHP>>正文


PHP Definition\Processor类代码示例

本文整理汇总了PHP中Symfony\Component\Config\Definition\Processor的典型用法代码示例。如果您正苦于以下问题:PHP Processor类的具体用法?PHP Processor怎么用?PHP Processor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Processor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load

 /**
  * Loads the product 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);
     $bundles = $container->getParameter('kernel.bundles');
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('block.xml');
     $loader->load('product.xml');
     $loader->load('orm.xml');
     $loader->load('form.xml');
     $loader->load('twig.xml');
     $loader->load('menu.xml');
     if (isset($bundles['FOSRestBundle']) && isset($bundles['NelmioApiDocBundle'])) {
         $loader->load('api_controllers.xml');
         $loader->load('api_form.xml');
         $loader->load('serializer.xml');
     }
     if (isset($bundles['SonataAdminBundle'])) {
         $loader->load('admin.xml');
     }
     $pool = $container->getDefinition('sonata.product.pool');
     // this value is altered by the AddProductProviderPass class
     $pool->addMethodCall('__hack', $config['products']);
     $this->registerParameters($container, $config);
     $this->registerDoctrineMapping($config);
     $this->registerSeoParameters($container, $config);
 }
开发者ID:sonata-project,项目名称:ecommerce,代码行数:34,代码来源:SonataProductExtension.php

示例2: testConfigTree

 /**
  * @dataProvider getDebugModes
  */
 public function testConfigTree($options, $results)
 {
     $processor = new Processor();
     $configuration = new Configuration(array());
     $config = $processor->processConfiguration($configuration, array($options));
     $this->assertEquals($results, $config);
 }
开发者ID:laubosslink,项目名称:lab,代码行数:10,代码来源:ConfigurationTest.php

示例3: load

 /**
  * {@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']);
 }
开发者ID:foreverglory,项目名称:oauth-bundle,代码行数:28,代码来源:GloryOAuthExtension.php

示例4: Parser

 function __construct($configFile)
 {
     $yaml = new Parser();
     $config = $yaml->parse(file_get_contents($configFile));
     $processor = new Processor();
     $this->config = $processor->processConfiguration(new Schema(), $config);
 }
开发者ID:promet,项目名称:settings_compile,代码行数:7,代码来源:Compiler.php

示例5: load

 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');
     }
 }
开发者ID:natxet,项目名称:JMSI18nRoutingBundle,代码行数:25,代码来源:JMSI18nRoutingExtension.php

示例6: testProcessConfiguration

 /**
  * @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);
 }
开发者ID:javihgil,项目名称:phphooker,代码行数:13,代码来源:ConfigurationTest.php

示例7: load

 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']));
     }
 }
开发者ID:aritoru,项目名称:KPhoenSmsSenderBundle,代码行数:32,代码来源:KPhoenSmsSenderExtension.php

示例8: __construct

 public function __construct(ContainerInterface $container, array $config)
 {
     $this->container = $container;
     $processor = new Processor();
     $configuration = new MappedContainerHandlerProviderConfiguration();
     $this->config = $processor->processConfiguration($configuration, [$config]);
 }
开发者ID:moriony,项目名称:rpc-server,代码行数:7,代码来源:MappedContainerHandlerProvider.php

示例9: load

 /**
  * 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);
 }
开发者ID:hostingnuggets,项目名称:WhiteOctoberAdminBundle,代码行数:35,代码来源:WhiteOctoberAdminExtension.php

示例10: testExtensions

 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']);
 }
开发者ID:symedit,项目名称:symedit,代码行数:7,代码来源:ConfigurationTest.php

示例11: load

 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']);
 }
开发者ID:platinumpixs,项目名称:symfony2-google-closure-library,代码行数:32,代码来源:PlatinumPixsGoogleClosureLibraryExtension.php

示例12: load

 /**
  * {@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');
     }
 }
开发者ID:salem-k,项目名称:ionic-serveur,代码行数:34,代码来源:NelmioApiDocExtension.php

示例13: execute

 /**
  * {@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));
 }
开发者ID:Kyra2778,项目名称:AMR,代码行数:31,代码来源:ConfigDebugCommand.php

示例14: load

 /**
  * 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('block.xml');
     $loader->load('form.xml');
     $loader->load('core.xml');
     $loader->load('exception.xml');
     $this->configureContext($container, $config);
     $this->configureLoaderChain($container, $config);
     $this->configureCache($container, $config);
     $this->configureForm($container, $config);
     $this->configureProfiler($container, $config);
     $this->configureException($container, $config);
     $this->configureMenus($container, $config);
     $this->configureClassesToCompile();
     $bundles = $container->getParameter('kernel.bundles');
     if ($config['templates']['block_base'] === null) {
         if (isset($bundles['SonataPageBundle'])) {
             $config['templates']['block_base'] = 'SonataPageBundle:Block:block_base.html.twig';
             $config['templates']['block_container'] = 'SonataPageBundle:Block:block_container.html.twig';
         } else {
             $config['templates']['block_base'] = 'SonataBlockBundle:Block:block_base.html.twig';
             $config['templates']['block_container'] = 'SonataBlockBundle:Block:block_container.html.twig';
         }
     }
     $container->getDefinition('sonata.block.twig.global')->replaceArgument(0, $config['templates']);
 }
开发者ID:serialken,项目名称:BugTracker,代码行数:36,代码来源:SonataBlockExtension.php

示例15: load

 /**
  * {@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']);
 }
开发者ID:vikey89,项目名称:Sylius,代码行数:30,代码来源:SyliusResourceExtension.php


注:本文中的Symfony\Component\Config\Definition\Processor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。