本文整理汇总了PHP中Symfony\Component\Config\Definition\Processor::processConfiguration方法的典型用法代码示例。如果您正苦于以下问题:PHP Processor::processConfiguration方法的具体用法?PHP Processor::processConfiguration怎么用?PHP Processor::processConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Config\Definition\Processor
的用法示例。
在下文中一共展示了Processor::processConfiguration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* 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: addListenerToSuite
/**
* @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);
}
示例3: Configuration
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);
}
示例4: loadConfiguration
/**
* 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;
}
示例5: load
/**
* {@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: getDefinition
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];
}
示例7: 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']);
}
示例8: 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);
}
示例9: 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');
}
}
示例10: Parser
function __construct($configFile)
{
$yaml = new Parser();
$config = $yaml->parse(file_get_contents($configFile));
$processor = new Processor();
$this->config = $processor->processConfiguration(new Schema(), $config);
}
示例11: 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']));
}
}
示例12: load
/**
* 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: 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']);
}
示例14: 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');
}
}
示例15: 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));
}