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


PHP NodeDefinition::beforeNormalization方法代码示例

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


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

示例1: addConfiguration

 public function addConfiguration(NodeDefinition $node)
 {
     $node->fixXmlConfig('user_provider');
     $builder = $node->beforeNormalization()->ifTrue(function ($v) {
         return isset($v['key']);
     })->then(function ($v) {
         if (isset($v['secret'])) {
             throw new \LogicException('Cannot set both key and secret options for remember_me, use only secret instead.');
         }
         @trigger_error('remember_me.key is deprecated since version 2.8 and will be removed in 3.0. Use remember_me.secret instead.', E_USER_DEPRECATED);
         $v['secret'] = $v['key'];
         unset($v['key']);
         return $v;
     })->end()->children();
     $builder->scalarNode('secret')->isRequired()->cannotBeEmpty()->end()->scalarNode('token_provider')->end()->arrayNode('user_providers')->beforeNormalization()->ifString()->then(function ($v) {
         return array($v);
     })->end()->prototype('scalar')->end()->end()->scalarNode('catch_exceptions')->defaultTrue()->end();
     foreach ($this->options as $name => $value) {
         if (is_bool($value)) {
             $builder->booleanNode($name)->defaultValue($value);
         } else {
             $builder->scalarNode($name)->defaultValue($value);
         }
     }
 }
开发者ID:tsurune,项目名称:Pruebas,代码行数:25,代码来源:RememberMeFactory.php

示例2: addConfiguration

 public function addConfiguration(NodeDefinition $node)
 {
     $node->beforeNormalization()->ifTrue(function ($v) {
         return isset($v['key']);
     })->then(function ($v) {
         if (isset($v['secret'])) {
             throw new \LogicException('Cannot set both key and secret options for http_digest, use only secret instead.');
         }
         @trigger_error('http_digest.key is deprecated since version 2.8 and will be removed in 3.0. Use http_digest.secret instead.', E_USER_DEPRECATED);
         $v['secret'] = $v['key'];
         unset($v['key']);
         return $v;
     })->end()->children()->scalarNode('provider')->end()->scalarNode('realm')->defaultValue('Secured Area')->end()->scalarNode('secret')->isRequired()->cannotBeEmpty()->end()->end();
 }
开发者ID:Kyra2778,项目名称:AMR,代码行数:14,代码来源:HttpDigestFactory.php

示例3: appendNameNormalization

 /**
  * @param NodeDefinition $node
  *
  * @return NodeDefinition
  */
 private function appendNameNormalization(NodeDefinition $node)
 {
     return $node->beforeNormalization()->ifTrue(function ($array) {
         foreach ($array as $item) {
             if (false !== $item && !isset($item['name'])) {
                 return true;
             }
         }
     })->then(function ($array) {
         foreach ($array as $name => $item) {
             if (false !== $item && !isset($item['name'])) {
                 $array[$name]['name'] = $name;
             }
         }
         return $array;
     })->end();
 }
开发者ID:olaurendeau,项目名称:RabbitMqAdminToolkitBundle,代码行数:22,代码来源:Configuration.php

示例4: addConfiguration

 /**
  * {@inheritDoc}
  */
 public function addConfiguration(NodeDefinition $node)
 {
     $node->beforeNormalization()->ifTrue(function ($v) {
         return empty($v['object_store_id']) && empty($v['connection_factory_id']);
     })->thenInvalid('You have to configure either "object_store_id" or "connection_factory_id" (for lazy-loading).')->end()->children()->scalarNode('object_store_id')->cannotBeEmpty()->end()->scalarNode('connection_factory_id')->cannotBeEmpty()->end()->scalarNode('container_name')->isRequired()->cannotBeEmpty()->end()->booleanNode('create_container')->defaultFalse()->end()->booleanNode('detect_content_type')->defaultTrue()->end()->end();
 }
开发者ID:p-bizouard,项目名称:KnpGaufretteBundle,代码行数:9,代码来源:OpenCloudAdapterFactory.php


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