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