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


PHP ArrayNodeDefinition::fixXmlConfig方法代码示例

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


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

示例1: addPostFilterSection

 private function addPostFilterSection(ArrayNodeDefinition $rootNode)
 {
     $rootNode
         ->fixXmlConfig('post_filter')
         ->children()
             ->arrayNode('post_filters')
                 ->canBeUnset()
                 ->useAttributeAsKey('name')
                 ->prototype('array')    
                     ->fixXmlConfig('param')
                     ->children()
                          ->scalarNode('class')->end()
                          ->arrayNode('params')
                             ->beforeNormalization()
                                ->ifTrue(function($v){ return !is_array($v); })
                                ->then(function($v){ return array($v); })
                             ->end()
                             ->prototype('scalar')->end()
                         ->end()
                     ->end()
                 ->end()
             ->end()
         ->end()
     ->end();	
 }
开发者ID:neni,项目名称:NeniPhptalBundle,代码行数:25,代码来源:Configuration.php

示例2: generateConfiguration

 /**
  * @param ArrayNodeDefinition $root
  */
 private function generateConfiguration(ArrayNodeDefinition $root)
 {
     $root->fixXmlConfig('exception')->children()->arrayNode('exceptions')->requiresAtLeastOneElement()->useAttributeAsKey('name')->normalizeKeys(false)->prototype('array')->children()->scalarNode('code')->end()->booleanNode('expose_message')->defaultValue('%kernel.debug%')->end()->end()->beforeNormalization()->ifTrue(function ($v) {
         return is_numeric($v);
     })->then(function ($v) {
         return ['code' => $v];
     })->end()->end()->end()->scalarNode('priority')->defaultValue(0)->end()->end();
 }
开发者ID:shopery,项目名称:error-bundle,代码行数:11,代码来源:Configuration.php

示例3: addIndexesSection

 /**
  * Adds the configuration for the "indexes" key
  */
 private function addIndexesSection(ArrayNodeDefinition $rootNode)
 {
     $rootNode->fixXmlConfig('index')->children()->arrayNode('indexes')->useAttributeAsKey('name')->prototype('array')->children()->scalarNode('index_name')->end()->scalarNode('client')->end()->scalarNode('finder')->treatNullLike(true)->defaultFalse()->end()->arrayNode('type_prototype')->children()->scalarNode('index_analyzer')->end()->scalarNode('search_analyzer')->end()->arrayNode('persistence')->validate()->ifTrue(function ($v) {
         return isset($v['driver']) && 'propel' === $v['driver'] && isset($v['listener']);
     })->thenInvalid('Propel doesn\'t support listeners')->ifTrue(function ($v) {
         return isset($v['driver']) && 'propel' === $v['driver'] && isset($v['repository']);
     })->thenInvalid('Propel doesn\'t support the "repository" parameter')->end()->children()->scalarNode('driver')->validate()->ifNotInArray($this->supportedDrivers)->thenInvalid('The driver %s is not supported. Please choose one of ' . json_encode($this->supportedDrivers))->end()->end()->scalarNode('identifier')->defaultValue('id')->end()->arrayNode('provider')->children()->scalarNode('query_builder_method')->defaultValue('createQueryBuilder')->end()->scalarNode('batch_size')->defaultValue(100)->end()->scalarNode('clear_object_manager')->defaultTrue()->end()->scalarNode('service')->end()->end()->end()->arrayNode('listener')->children()->scalarNode('insert')->defaultTrue()->end()->scalarNode('update')->defaultTrue()->end()->scalarNode('delete')->defaultTrue()->end()->scalarNode('service')->end()->variableNode('is_indexable_callback')->defaultNull()->end()->end()->end()->arrayNode('finder')->children()->scalarNode('service')->end()->end()->end()->arrayNode('elastica_to_model_transformer')->addDefaultsIfNotSet()->children()->scalarNode('hydrate')->defaultTrue()->end()->scalarNode('ignore_missing')->defaultFalse()->end()->scalarNode('query_builder_method')->defaultValue('createQueryBuilder')->end()->scalarNode('service')->end()->end()->end()->arrayNode('model_to_elastica_transformer')->addDefaultsIfNotSet()->children()->scalarNode('service')->end()->end()->end()->end()->end()->end()->end()->variableNode('settings')->defaultValue(array())->end()->end()->append($this->getTypesNode())->end()->end()->end();
 }
开发者ID:r1pp3rj4ck,项目名称:FOSElasticaBundle,代码行数:11,代码来源:Configuration.php

示例4: addResolversSection

 /**
  * Add resolvers section
  *
  * @param \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition $node
  * @param array $factories
  */
 protected function addResolversSection(ArrayNodeDefinition $node, array $factories)
 {
     $resolverNodeBuilder = $node->fixXmlConfig('resolver')->children()->arrayNode('resolvers')->useAttributeAsKey('name')->prototype('array')->performNoDeepMerging()->children();
     foreach ($factories as $name => $factory) {
         $factoryNode = $resolverNodeBuilder->arrayNode($name)->canBeUnset();
         $factory->addConfiguration($factoryNode);
     }
 }
开发者ID:harpcio,项目名称:FileUploaderBundle,代码行数:14,代码来源:MainConfiguration.php

示例5: addSourcesConfiguration

 /**
  * @param ArrayNodeDefinition $rootNode
  */
 private function addSourcesConfiguration(ArrayNodeDefinition $rootNode)
 {
     $sourcesNodeBuilder = $rootNode->fixXmlConfig('source')->children()->arrayNode('sources')->children();
     foreach ($this->configurationSourceFactories as $sourceFactory) {
         $sourceNode = $sourcesNodeBuilder->arrayNode($sourceFactory->getName())->canBeEnabled();
         $sourceFactory->buildConfiguration($sourceNode);
     }
 }
开发者ID:polisys,项目名称:Sylius,代码行数:11,代码来源:Configuration.php

示例6: addThemeMapSection

 private function addThemeMapSection(ArrayNodeDefinition $rootNode)
 {
     $rootNode->fixXmlConfig('rule', 'theme_map')->children()->arrayNode('theme_map')->cannotBeOverwritten()->prototype('array')->children()->scalarNode('requires_channel')->defaultNull()->end()->scalarNode('path')->defaultNull()->info('use the urldecoded format')->example('^/path to resource/')->end()->scalarNode('host')->defaultNull()->end()->scalarNode('ip')->defaultNull()->end()->arrayNode('methods')->beforeNormalization()->ifString()->then(function ($v) {
         return preg_split('/\\s*,\\s*/', $v);
     })->end()->prototype('scalar')->end()->end()->end()->children()->scalarNode('theme')->end()->end()->fixXmlConfig('role')->children()->arrayNode('roles')->beforeNormalization()->ifString()->then(function ($v) {
         return preg_split('/\\s*,\\s*/', $v);
     })->end()->prototype('scalar')->end()->end()->end()->end()->end()->end();
 }
开发者ID:geoffreytran,项目名称:zym,代码行数:8,代码来源:Configuration.php

示例7: addProvidersNode

 protected function addProvidersNode(ArrayNodeDefinition $rootNode)
 {
     $rootNode->fixXmlConfig('provider')->children()->arrayNode('providers')->isRequired()->requiresAtLeastOneElement()->prototype('scalar')->end()->end()->end();
     foreach ($this->factories as $name => $factory) {
         $factoryNode = $rootNode->children()->arrayNode($name)->canBeUnset();
         $factory->addConfiguration($factoryNode);
     }
     return $rootNode;
 }
开发者ID:aritoru,项目名称:KPhoenSmsSenderBundle,代码行数:9,代码来源:Configuration.php

示例8: addEventStoreSection

 /**
  * Add event store section to configuration tree
  *
  * @link https://github.com/prooph/event-store
  *
  * @param ArrayNodeDefinition $node
  */
 private function addEventStoreSection(ArrayNodeDefinition $node)
 {
     $treeBuilder = new TreeBuilder();
     $repositoriesNode = $treeBuilder->root('repositories');
     /** @var $repositoriesNode ArrayNodeDefinition */
     $repositoryNode = $repositoriesNode->requiresAtLeastOneElement()->useAttributeAsKey('name')->prototype('array');
     $repositoryNode->children()->scalarNode('repository_class')->end()->scalarNode('aggregate_type')->end()->scalarNode('aggregate_translator')->end()->scalarNode('snapshot_store')->defaultValue(null)->end()->scalarNode('stream_name')->defaultValue(null)->end()->booleanNode('one_stream_per_aggregate')->defaultValue(false)->end()->end();
     $node->fixXmlConfig('store', 'stores')->children()->arrayNode('stores')->requiresAtLeastOneElement()->useAttributeAsKey('name')->prototype('array')->fixXmlConfig('repository', 'repositories')->children()->scalarNode('event_emitter')->defaultValue('prooph_event_store.action_event_emitter')->end()->scalarNode('adapter')->end()->append($repositoriesNode)->end()->end();
 }
开发者ID:prooph,项目名称:event-store-symfony-bundle,代码行数:16,代码来源:Configuration.php

示例9: addMappingsSection

 private function addMappingsSection(ArrayNodeDefinition $node)
 {
     $defaults = self::getMappingDefaults();
     // @formatter:off
     /* @noinspection PhpUndefinedMethodInspection */
     $node->fixXmlConfig('mapping')->children()->arrayNode('mappings')->useAttributeAsKey('name')->prototype('array')->beforeNormalization()->ifString()->then(function ($value) {
         return ['storage' => $value];
     })->end()->addDefaultsIfNotSet()->children()->scalarNode('file_getter')->defaultValue($defaults['file_getter'])->end()->scalarNode('file_setter')->defaultValue($defaults['file_setter'])->end()->scalarNode('uri_setter')->defaultValue($defaults['uri_setter'])->end()->scalarNode('file_info_setter')->defaultValue($defaults['file_info_setter'])->end()->scalarNode('fs_prefix')->defaultValue($defaults['fs_prefix'])->end()->scalarNode('uri_prefix')->defaultValue($defaults['uri_prefix'])->end()->scalarNode('fs_adapter')->defaultValue($defaults['fs_adapter'])->end()->scalarNode('naming_strategy')->defaultValue($defaults['naming_strategy'])->end()->scalarNode('delete_old_file')->defaultValue($defaults['delete_old_file'])->end()->scalarNode('delete_on_remove')->defaultValue($defaults['delete_on_remove'])->end()->scalarNode('inject_uri_on_load')->defaultValue($defaults['inject_uri_on_load'])->end()->scalarNode('inject_file_info_on_load')->defaultValue($defaults['inject_file_info_on_load'])->end()->end()->end()->end()->end();
     return $node;
 }
开发者ID:atom-azimov,项目名称:uploader-bundle,代码行数:10,代码来源:Configuration.php

示例10: addClientsSection

 /**
  * Adds the snc_redis.clients configuration
  *
  * @param ArrayNodeDefinition $rootNode
  */
 private function addClientsSection(ArrayNodeDefinition $rootNode)
 {
     $rootNode->fixXmlConfig('client')->children()->arrayNode('clients')->isRequired()->requiresAtLeastOneElement()->useAttributeAsKey('alias', false)->prototype('array')->fixXmlConfig('connection')->children()->arrayNode('connections')->isRequired()->beforeNormalization()->ifString()->then(function ($v) {
         return (array) $v;
     })->end()->prototype('scalar')->end()->end()->scalarNode('alias')->isRequired()->end()->arrayNode('options')->addDefaultsIfNotSet()->children()->scalarNode('profile')->defaultValue('2.0')->beforeNormalization()->ifTrue(function ($v) {
         return false === is_string($v);
     })->then(function ($v) {
         return sprintf('%.1f', $v);
     })->end()->end()->scalarNode('cluster')->defaultNull()->end()->end()->end()->end()->end()->end()->end();
 }
开发者ID:realestateconz,项目名称:SncRedisBundle,代码行数:15,代码来源:Configuration.php

示例11: addChannelHandlers

 /**
  * @param ArrayNodeDefinition $rootNode
  */
 private function addChannelHandlers(ArrayNodeDefinition $rootNode)
 {
     $rootNode->fixXmlConfig('loggerChannel')->children()->arrayNode('logger_channel')->canBeUnset()->useAttributeAsKey('name')->prototype('array')->fixXmlConfig('channel', 'elements')->canBeUnset()->beforeNormalization()->ifString()->then(function ($v) {
         return array('elements' => array($v));
     })->end()->beforeNormalization()->ifTrue(function ($v) {
         return is_array($v) && is_numeric(key($v));
     })->then(function ($v) {
         return array('elements' => $v);
     })->end()->validate()->ifTrue(function ($v) {
         return empty($v);
     })->thenUnset()->end()->validate()->always($this->getChannelTypeValidator())->end()->children()->scalarNode('type')->validate()->ifNotInArray(array('inclusive', 'exclusive'))->thenInvalid('The type of channels has to be inclusive or exclusive')->end()->end()->arrayNode('elements')->prototype('scalar')->end()->end()->end()->end()->end()->end()->end();
 }
开发者ID:bencolson,项目名称:EasyAuditBundle,代码行数:15,代码来源:Configuration.php

示例12: addRulesSection

 private function addRulesSection(ArrayNodeDefinition $rootNode)
 {
     $rootNode->fixXmlConfig('rule', 'rules')->children()->arrayNode('rules')->cannotBeOverwritten()->prototype('array')->children()->scalarNode('unless_role')->defaultNull()->end()->scalarNode('path')->defaultNull()->info('URL path info')->end()->arrayNode('method')->beforeNormalization()->ifString()->then(function ($v) {
         return preg_split('/\\s*,\\s*/', $v);
     })->end()->useAttributeAsKey('name')->prototype('scalar')->end()->info('HTTP method')->end()->arrayNode('ips')->beforeNormalization()->ifString()->then(function ($v) {
         return preg_split('/\\s*,\\s*/', $v);
     })->end()->useAttributeAsKey('name')->prototype('scalar')->end()->info('List of ips')->end()->arrayNode('attributes')->addDefaultsIfNotSet()->cannotBeEmpty()->treatNullLike(array())->info('Request attributes')->end()->scalarNode('domain')->defaultNull()->info('depreciated, use host instead')->end()->scalarNode('host')->defaultNull()->info('URL host name')->end()->scalarNode('controller')->defaultNull()->info('controller action name')->end()->scalarNode('reverse_proxy_ttl')->defaultNull()->end()->arrayNode('controls')->beforeNormalization()->ifString()->then(function ($v) {
         return preg_split('/\\s*,\\s*/', $v);
     })->end()->useAttributeAsKey('name')->prototype('scalar')->end()->end()->arrayNode('vary')->beforeNormalization()->ifString()->then(function ($v) {
         return preg_split('/\\s*,\\s*/', $v);
     })->end()->prototype('scalar')->end()->end()->end()->end()->end()->end();
 }
开发者ID:saidul,项目名称:LiipCacheControlBundle,代码行数:12,代码来源:Configuration.php

示例13: addProvidersSection

 public function addProvidersSection(ArrayNodeDefinition $rootNode)
 {
     $providerNodeBuilder = $rootNode->fixXmlConfig('provider')->children()->arrayNode('providers')->example(array('sis' => array('base_url' => 'http://sisapi.example.com', 'http_client' => 'Guzzle', 'auth' => array('module' => 'Auth2', 'rpc_path' => '/auth/rpc', 'username' => 'service_username', 'password' => 'service_password', 'service_application' => 'service_app', 'service_url' => 'https://www.auth.stg.id.ubc.ca'), 'serializer' => 'JMS')))->isRequired()->requiresAtLeastOneElement()->useAttributeAsKey('class')->prototype('array');
     $providerNodeBuilder->children()->scalarNode('base_url')->end()->scalarNode('http_client')->defaultValue('Guzzle')->end()->scalarNode('serializer')->defaultValue('JMS')->end()->arrayNode('auth')->children()->scalarNode('module')->defaultValue('HttpBasic')->end()->scalarNode('rpc_path')->defaultValue('/auth/rpc')->end()->scalarNode('username')->isRequired()->end()->scalarNode('password')->isRequired()->end()->scalarNode('service_application')->end()->scalarNode('service_url')->defaultValue('https://www.auth.stg.id.ubc.ca')->end()->end()->validate()->ifTrue(function ($v) {
         return 'Auth2' === $v['module'] && empty($v['service_application']);
     })->thenInvalid('The service_application name has to be specified to use Auth2 module.')->end()->end()->scalarNode('path')->end()->end();
     $providerNodeBuilder->end()->validate()->ifTrue(function ($v) {
         return isset($v['sis']) && empty($v['sis']['base_url']);
     })->thenInvalid('The base_url has to specified to use sis data provider.')->end()->validate()->ifTrue(function ($v) {
         return isset($v['xml']) && empty($v['xml']['path']);
     })->thenInvalid('The base_url has to specified to use xml data provider.')->end()->end();
 }
开发者ID:ubc,项目名称:ltcommons-bundle,代码行数:12,代码来源:Configuration.php

示例14: addGlobalsSection

 private function addGlobalsSection(ArrayNodeDefinition $rootNode)
 {
     $rootNode->fixXmlConfig('global')->children()->arrayNode('globals')->useAttributeAsKey('key')->example(array('foo' => '"@bar"', 'pi' => 3.14))->prototype('array')->beforeNormalization()->ifTrue(function ($v) {
         return is_string($v) && 0 === strpos($v, '@');
     })->then(function ($v) {
         return array('id' => substr($v, 1), 'type' => 'service');
     })->end()->beforeNormalization()->ifTrue(function ($v) {
         if (is_array($v)) {
             $keys = array_keys($v);
             sort($keys);
             return $keys !== array('id', 'type') && $keys !== array('value');
         }
         return true;
     })->then(function ($v) {
         return array('value' => $v);
     })->end()->children()->scalarNode('id')->end()->scalarNode('type')->validate()->ifNotInArray(array('service'))->thenInvalid('The %s type is not supported')->end()->end()->variableNode('value')->end()->end()->end()->end()->end();
 }
开发者ID:laubosslink,项目名称:lab,代码行数:17,代码来源:Configuration.php

示例15: addFilesystemSection

 private function addFilesystemSection(ArrayNodeDefinition $node)
 {
     $node
         ->fixXmlConfig('filesystem')
         ->children()
             ->arrayNode('filesystems')
                 ->useAttributeAsKey('name')
                 ->prototype('array')
                 ->children()
                     ->scalarNode('adapter')->isRequired()->end()
                     ->scalarNode('cache')->defaultNull()->end()
                     ->scalarNode('alias')->defaultNull()->end()
                     ->scalarNode('mount')->defaultNull()->end()
                 ->end()
             ->end()
         ->end()
     ;
 }
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:18,代码来源:Configuration.php


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