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


PHP ContainerBuilder::camelize方法代码示例

本文整理汇总了PHP中Symfony\Component\DependencyInjection\ContainerBuilder::camelize方法的典型用法代码示例。如果您正苦于以下问题:PHP ContainerBuilder::camelize方法的具体用法?PHP ContainerBuilder::camelize怎么用?PHP ContainerBuilder::camelize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\DependencyInjection\ContainerBuilder的用法示例。


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

示例1: load

 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     foreach ($config['actions'] as $key => $value) {
         if ($value['max_number_by_ip']) {
             $definition = new Definition('Kunstmaan\\VotingBundle\\EventListener\\Security\\MaxNumberByIpEventListener');
             $definition->addArgument(new Reference('kunstmaan_voting.services.repository_resolver'));
             $definition->addArgument($value['max_number_by_ip']);
             $definition->addTag('kernel.event_listener', array('event' => 'kunstmaan_voting.' . lcfirst(ContainerBuilder::camelize($key)), 'method' => 'onVote', 'priority' => 100));
             $container->setDefinition('kunstmaan_voting.security.' . $key . '.max_number_by_ip_event_listener', $definition);
         }
     }
     $possibleActions = array('up_vote', 'down_vote', 'facebook_like', 'facebook_send', 'linkedin_share');
     $votingDefaultValue = $config['voting_default_value'];
     // If the user overwrites the voting_default_value in paramters file, we use this one
     if ($container->hasParameter('voting_default_value')) {
         $votingDefaultValue = $container->getParameter('voting_default_value');
     }
     // When no values are defined, initialize with defaults
     foreach ($possibleActions as $action) {
         if (!isset($config['actions'][$action]) || !is_array($config['actions'][$action])) {
             $config['actions'][$action]['default_value'] = $action == 'down_vote' ? -1 * $votingDefaultValue : $votingDefaultValue;
         }
     }
     $container->setParameter('kuma_voting.actions', $config['actions']);
 }
开发者ID:hyrmedia,项目名称:KunstmaanBundlesCMS,代码行数:32,代码来源:KunstmaanVotingExtension.php

示例2: loadAmqpTransport

 private function loadAmqpTransport(array $config, ContainerBuilder $container)
 {
     $this->loader->load('transport/amqp/amqp.xml');
     $this->loader->load(sprintf('transport/amqp/%s.xml', $config['driver']));
     if (class_exists('JMS\\AopBundle\\JMSAopBundle')) {
         $this->loader->load('transport/amqp/tracer.xml');
     }
     $camelizeKey = function (array $config) {
         $camelized = [];
         foreach ($config as $key => $value) {
             $camelized[lcfirst(ContainerBuilder::camelize($key))] = $value;
         }
         return $camelized;
     };
     $definitions = [];
     foreach ($config['connections'] as $name => $connectionConfig) {
         $exchanges = $connectionConfig['exchanges'];
         unset($connectionConfig['exchanges']);
         $queues = $connectionConfig['queues'];
         unset($connectionConfig['queues']);
         $amqp = new DefinitionDecorator('event_band.transport.amqp.definition');
         $amqp->addMethodCall('connection', [$camelizeKey($connectionConfig)]);
         foreach ($exchanges as $exchange => $exchangeConfig) {
             $exchangeType = $exchangeConfig['type'];
             unset($exchangeConfig['type']);
             $amqp->addMethodCall($exchangeType . 'Exchange', [$exchange, $camelizeKey($exchangeConfig)]);
         }
         foreach ($queues as $queue => $queueConfig) {
             $amqp->addMethodCall('queue', [$queue, $camelizeKey($queueConfig)]);
         }
         $definitionId = self::getTransportDefinitionId('amqp', $name);
         $container->setDefinition($definitionId, $amqp);
         $definitions[$name] = $definitionId;
         $connection = new DefinitionDecorator('event_band.transport.amqp.connection_definition');
         $connection->setFactoryService($definitionId);
         $connectionId = self::getAmqpConnectionDefinitionId($name);
         $container->setDefinition($connectionId, $connection);
         $factory = new DefinitionDecorator(sprintf('event_band.transport.amqp.connection_factory.%s', $config['driver']));
         $factory->addMethodCall('setDefinition', [new Reference($connectionId)]);
         $container->setDefinition(self::getAmqpLibConnectionFactoryId($name), $factory);
         $driver = new DefinitionDecorator('event_band.transport.amqp.driver.' . $config['driver']);
         $driver->replaceArgument(0, new Reference($this->getAmqpLibConnectionFactoryId($name)));
         $container->setDefinition($this->getAmqpDriverId($name), $driver);
         $configurator = new DefinitionDecorator('event_band.transport.amqp.configurator');
         $configurator->replaceArgument(0, new Reference($this->getAmqpDriverId($name)));
         $container->setDefinition(self::getTypedTransportConfiguratorId('amqp', $name), $configurator);
         $container->getDefinition(self::getTransportConfiguratorId())->addMethodCall('registerConfigurator', ['amqp.' . $name, new Reference(self::getTypedTransportConfiguratorId('amqp', $name))]);
     }
     $container->setParameter('event_band.transport_definitions', array_merge($container->getParameter('event_band.transport_definitions'), ['amqp' => $definitions]));
     foreach ($config['converters'] as $name => $converterConfig) {
         $definition = new DefinitionDecorator('event_band.transport.amqp.converter.serialize');
         $definition->replaceArgument(0, new Reference(self::getSerializerId($converterConfig['parameters']['serializer'])));
         $container->setDefinition(self::getAmqpConverterId($name), $definition);
     }
 }
开发者ID:coyl,项目名称:EventBandSymfonyBundle,代码行数:55,代码来源:EventBandExtension.php

示例3: load

 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $config = $processor->processConfiguration(new Configuration(), $configs);
     foreach (array_keys($config) as $key) {
         $container->setParameter('bitpay.' . $key, $config[$key]);
     }
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__));
     $loader->load('services.xml');
     $container->setParameter('network.class', 'Bitpay\\Network\\' . ContainerBuilder::camelize($config['network']));
     $container->setParameter('adapter.class', 'Bitpay\\Client\\Adapter\\' . ContainerBuilder::camelize($config['adapter']) . 'Adapter');
     $container->setParameter('key_storage.class', $config['key_storage']);
 }
开发者ID:Invision70,项目名称:php-bitpay-client,代码行数:13,代码来源:BitpayExtension.php


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