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


PHP NodeBuilder::arrayNode方法代码示例

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


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

示例1: getRootNode

 private function getRootNode()
 {
     $nodeBuilder = new NodeBuilder();
     $rootNode = $nodeBuilder->arrayNode(null);
     $this->addConfiguration($rootNode);
     return $rootNode->getNode();
 }
开发者ID:smaft-sarl,项目名称:okta-php-sdk,代码行数:7,代码来源:Configuration.php

示例2: addVisitorsSection

 private function addVisitorsSection(NodeBuilder $builder)
 {
     $builder->arrayNode('visitors')->addDefaultsIfNotSet()->children()->arrayNode('json')->addDefaultsIfNotSet()->children()->scalarNode('options')->defaultValue(0)->beforeNormalization()->ifArray()->then(function ($v) {
         $options = 0;
         foreach ($v as $option) {
             if (is_numeric($option)) {
                 $options |= (int) $option;
             } elseif (defined($option)) {
                 $options |= constant($option);
             } else {
                 throw new InvalidArgumentException('Expected either an integer representing one of the JSON_ constants, or a string of the constant itself.');
             }
         }
         return $options;
     })->end()->beforeNormalization()->ifString()->then(function ($v) {
         if (is_numeric($v)) {
             $value = (int) $v;
         } elseif (defined($v)) {
             $value = constant($v);
         } else {
             throw new InvalidArgumentException('Expected either an integer representing one of the JSON_ constants, or a string of the constant itself.');
         }
         return $value;
     })->end()->validate()->always(function ($v) {
         if (!is_int($v)) {
             throw new InvalidArgumentException('Expected either integer value or a array of the JSON_ constants.');
         }
         return $v;
     })->end()->end()->end()->end()->arrayNode('xml')->fixXmlConfig('whitelisted-doctype', 'doctype_whitelist')->addDefaultsIfNotSet()->children()->arrayNode('doctype_whitelist')->prototype('scalar')->end()->end()->end()->end()->end()->end();
 }
开发者ID:ramol,项目名称:JMSSerializerBundle,代码行数:30,代码来源:Configuration.php

示例3: addDirectives

 private function addDirectives(NodeBuilder $node)
 {
     $directives = array('default', 'script', 'object', 'style', 'img', 'media', 'frame', 'font', 'connect');
     foreach ($directives as $directive) {
         $node->arrayNode($directive)->prototype('scalar')->end();
     }
     return $node;
 }
开发者ID:mgdigital,项目名称:NelmioSecurityBundle,代码行数:8,代码来源:Configuration.php

示例4: addTypes

 /**
  * @param NodeBuilder $node
  *
  * @return $this
  */
 public function addTypes(NodeBuilder $node)
 {
     // @formatter:off
     /** @noinspection PhpUndefinedMethodInspection */
     $node->arrayNode('types')->prototype('array')->addDefaultsIfNotSet()->children()->arrayNode('assets')->defaultValue([])->prototype('array')->children()->scalarNode('src')->isRequired()->end()->scalarNode('inline')->defaultFalse()->end()->end()->end()->end()->arrayNode('groups')->defaultValue([])->prototype('array')->children()->booleanNode('default')->defaultFalse()->end()->arrayNode('assets')->prototype('scalar')->end()->end()->arrayNode('routes')->defaultValue([])->prototype('scalar')->end()->end()->end()->end()->end()->end()->end();
     // @formatter:on
     return $this;
 }
开发者ID:ZnanyLekarz,项目名称:AssetsBundle,代码行数:13,代码来源:Configuration.php

示例5: addClientConfiguration

 /**
  * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $node
  */
 private function addClientConfiguration(NodeBuilder $node)
 {
     $node->scalarNode('id')->isRequired()->cannotBeEmpty()->info('Your Billomat Id')->example('company_name');
     $node->scalarNode('api_key')->isRequired()->cannotBeEmpty()->info('Your Billomat API key')->example('12345abc67890def12345abc67890def');
     $children = $node->arrayNode('application')->addDefaultsIfNotSet()->children();
     $this->addApplicationConfiguration($children);
     $node->booleanNode('wait_for_rate_limit_reset')->defaultFalse()->info('Wait for rate limit reset if rate limit is reached during a request');
     $node->booleanNode('async')->defaultFalse()->info('Use asynchronous requests with the Guzzle Async Plugin');
 }
开发者ID:phobetor,项目名称:billomat-bundle,代码行数:12,代码来源:Configuration.php

示例6: addSemanticConfig

 /**
  * Adds semantic configuration definition.
  *
  * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system.<siteaccess>
  */
 public function addSemanticConfig(NodeBuilder $nodeBuilder)
 {
     $nodeBuilder->arrayNode('imagemagick')->info('DEPRECATED.')->children()->scalarNode('pre_parameters')->info('Parameters that must be run BEFORE the filenames and filters')->end()->scalarNode('post_parameters')->info('Parameters that must be run AFTER the filenames and filters')->end()->end()->end()->arrayNode('image_variations')->info('Configuration for your image variations (aka "image aliases")')->example(array('my_image_variation' => array('reference' => '~', 'filters' => array(array('name' => 'geometry/scaledownonly', 'params' => array(400, 350)))), 'my_cropped_variation' => array('reference' => 'my_image_variation', 'filters' => array(array('name' => 'geometry/scalewidthdownonly', 'params' => array(300)), array('name' => 'geometry/crop', 'params' => array(300, 300, 0, 0))))))->useAttributeAsKey('variation_name')->normalizeKeys(false)->prototype('array')->children()->scalarNode('reference')->info('Tells the system which original variation to use as reference image. Defaults to original')->example(array('reference' => 'large'))->end()->arrayNode('filters')->info('A list of filters to run, each filter must be supported by the active image converters')->useAttributeAsKey('name')->normalizeKeys(false)->prototype('array')->info('Array/Hash of parameters to pass to the filter')->useAttributeAsKey('options')->beforeNormalization()->ifTrue(function ($v) {
         // Check if passed array only contains a "params" key (BC with <=5.3).
         return is_array($v) && count($v) === 1 && isset($v['params']);
     })->then(function ($v) {
         // If we have the "params" key, just use the value.
         return $v['params'];
     })->end()->prototype('variable')->end()->end()->end()->arrayNode('post_processors')->info('Post processors as defined in LiipImagineBundle. See https://github.com/liip/LiipImagineBundle/blob/master/Resources/doc/filters.md#post-processors')->useAttributeAsKey('name')->prototype('array')->useAttributeAsKey('name')->prototype('variable')->end()->end()->end()->end()->end()->end();
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:15,代码来源:Image.php

示例7: addSemanticConfig

    /**
     * Adds semantic configuration definition.
     *
     * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system.<siteaccess>
     *
     * @return void
     */
    public function addSemanticConfig(NodeBuilder $nodeBuilder)
    {
        $nodeBuilder->arrayNode(static::NODE_KEY)->info(static::INFO)->children()->arrayNode('block')->useAttributeAsKey("key")->normalizeKeys(false)->prototype("array")->children()->scalarNode("template")->isRequired()->info("Your template path, as MyBundle:subdir:my_template.html.twig")->end()->scalarNode('controller')->info(<<<EOT
Use custom controller instead of the default one to display a block matching your rules.
You can use the controller reference notation supported by Symfony.
EOT
)->example('MyBundle:MyControllerClass:viewBlock')->end()->arrayNode("match")->info("Condition matchers configuration")->useAttributeAsKey("key")->prototype("variable")->end()->end()->end()->end()->end()->end()->beforeNormalization()->always()->then(function ($v) {
            return array('block' => $v);
        })->end()->end();
    }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:17,代码来源:BlockView.php

示例8: getRelationFieldsNodeDefinition

 protected function getRelationFieldsNodeDefinition($level = 1)
 {
     $nodeBuilder = new NodeBuilder();
     $relationFieldsNode = $nodeBuilder->arrayNode('relation_fields');
     if ($level < self::RELATION_FIELDS_NODE_MAX_LEVEL) {
         $relationFieldsNode->prototype('array')->children()->scalarNode('name')->end()->enumNode('target_type')->values($this->targetTypes)->end()->arrayNode('target_fields')->prototype('scalar')->end()->end()->enumNode('relation_type')->values($this->relationTypes)->end()->append($this->getRelationFieldsNodeDefinition($level + 1))->end()->validate()->ifTrue(function ($value) {
             return !empty($value['relation_type']) && empty($value['relation_fields']) || !empty($value['relation_fields']) && empty($value['relation_type']);
         })->thenInvalid('Both or none of relation_type and relation_fields should be specified for field')->end()->end();
     }
     return $relationFieldsNode;
 }
开发者ID:Maksold,项目名称:platform,代码行数:11,代码来源:Configuration.php

示例9: addSemanticConfig

 public function addSemanticConfig(NodeBuilder $nodeBuilder)
 {
     $fieldTypeNodeBuilder = $nodeBuilder->arrayNode("fieldtypes")->children();
     // Delegate to configuration parsers
     foreach ($this->configParsers as $parser) {
         if ($parser instanceof FieldTypeParserInterface) {
             $parser->addSemanticConfig($fieldTypeNodeBuilder);
         } else {
             $parser->addSemanticConfig($nodeBuilder);
         }
     }
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:12,代码来源:ConfigParser.php

示例10: addSemanticConfig

    /**
     * Adds semantic configuration definition.
     *
     * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system.<siteaccess>
     */
    public function addSemanticConfig(NodeBuilder $nodeBuilder)
    {
        $nodeBuilder->arrayNode(static::NODE_KEY)->info(static::INFO)->useAttributeAsKey("key")->normalizeKeys(false)->prototype("array")->useAttributeAsKey("key")->normalizeKeys(false)->info("View selection rulesets, grouped by view type. Key is the view type (e.g. 'full', 'line', ...)")->prototype("array")->children()->scalarNode("template")->info("Your template path, as MyBundle:subdir:my_template.html.twig")->end()->scalarNode('controller')->info(<<<EOT
Use custom controller instead of the default one to display a content matching your rules.
You can use the controller reference notation supported by Symfony.
EOT
)->example('MyBundle:MyControllerClass:view')->end()->arrayNode("match")->info("Condition matchers configuration")->isRequired()->useAttributeAsKey("key")->prototype("variable")->end()->end()->arrayNode("params")->info(<<<EOT
Arbitrary params that will be passed in the ContentView object, manageable by ViewProviders.
Those params will NOT be passed to the resulting view template by default.
EOT
)->example(array("foo" => "%some.parameter.reference%", "osTypes" => array("osx", "linux", "windows")))->useAttributeAsKey("key")->prototype("variable")->end()->end()->end()->end()->end()->end();
    }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:17,代码来源:View.php

示例11: applyConfiguration

 /** {@inheritdoc} */
 public static function applyConfiguration(NodeBuilder $node_builder)
 {
     $uglify = $node_builder->arrayNode('uglifyjs')->canBeEnabled()->children();
     $compress = $uglify->arrayNode('compress')->cannotBeEmpty()->addDefaultsIfNotSet()->children();
     foreach (self::$config_map as list($option, $default, $info)) {
         $compress->booleanNode($option)->defaultValue($default)->info($info)->end();
     }
     $compress->arrayNode('global_defs')->info('global definition')->prototype('scalar')->end()->end();
     $uglify->arrayNode('mangle_except')->defaultValue(['$super', '$', 'exports', 'require'])->info('Variable names to not mangle')->prototype('scalar')->end();
     $uglify->booleanNode('source_map')->defaultTrue()->info('The plugin uses SourceMaps to map error message locations to modules. This slows down the compilation')->end();
     $uglify->scalarNode('test')->defaultValue('/\\.js($|\\?)/i')->info('RegExp to filter processed files')->end();
     $uglify->booleanNode('minimize')->defaultTrue()->info('Whether to minimize or not')->end();
 }
开发者ID:hostnet,项目名称:webpack-bundle,代码行数:14,代码来源:UglifyJsPlugin.php

示例12: addValidationSection

 private function addValidationSection(NodeBuilder $rootNode)
 {
     $rootNode->arrayNode('validation')->canBeUnset()->beforeNormalization()->ifTrue(function ($v) {
         return is_array($v) && !empty($v['annotations']) && !empty($v['namespace']);
     })->then(function ($v) {
         $v['annotations'] = array('namespace' => $v['namespace']);
         unset($v['namespace']);
         return $v;
     })->end()->booleanNode('enabled')->end()->arrayNode('annotations')->canBeUnset()->treatNullLike(array())->treatTrueLike(array())->fixXmlConfig('namespace')->arrayNode('namespaces')->useAttributeAsKey('prefix')->prototype('scalar')->beforeNormalization()->ifTrue(function ($v) {
         return is_array($v) && isset($v['namespace']);
     })->then(function ($v) {
         return $v['namespace'];
     })->end()->end()->end()->end()->end();
 }
开发者ID:noelg,项目名称:symfony-demo,代码行数:14,代码来源:Configuration.php

示例13: addDriverSettings

 /**
  * @param string      $driver
  * @param NodeBuilder $rootNode
  */
 public function addDriverSettings($driver, NodeBuilder $rootNode)
 {
     $driverNode = $rootNode->arrayNode($driver)->fixXmlConfig('server');
     if ($driver == 'Memcache') {
         $finalNode = $driverNode->info('All options except "servers" are Memcached options. See http://www.php.net/manual/en/memcached.constants.php')->addDefaultsIfNotSet()->children()->booleanNode('compression')->end()->scalarNode('serializer')->end()->scalarNode('prefix_key')->end()->scalarNode('hash')->end()->scalarNode('distribution')->end()->booleanNode('libketama_compatible')->end()->booleanNode('buffer_writes')->end()->booleanNode('binary_protocol')->end()->booleanNode('no_block')->end()->booleanNode('tcp_nodelay')->end()->booleanNode('auto_eject_hosts')->end()->scalarNode('socket_send_size')->end()->scalarNode('socket_recv_size')->end()->scalarNode('connect_timeout')->end()->scalarNode('retry_timeout')->end()->scalarNode('send_timeout')->end()->scalarNode('recv_timeout')->end()->scalarNode('poll_timeout')->end()->booleanNode('cache_lookups')->end()->scalarNode('server_failure_limit')->end()->arrayNode('servers')->info('Your Memcached server(s) configuration.')->requiresAtLeastOneElement()->example(array(array('server' => '127.0.0.1', 'port' => '11211')))->defaultValue(array(array('server' => '127.0.0.1', 'port' => '11211')))->prototype('array')->children()->scalarNode('server')->defaultValue('127.0.0.1')->end()->scalarNode('port')->defaultValue('11211')->end()->scalarNode('weight')->end()->end()->end()->end()->end();
     } elseif ($driver == 'Redis') {
         $finalNode = $driverNode->info("Accepts server info, password, and database.")->addDefaultsIfNotSet()->children()->scalarNode('password')->end()->scalarNode('database')->end()->arrayNode('servers')->info('Configuration of Redis server(s)')->requiresAtLeastOneElement()->example(array(array('server' => '127.0.0.1', 'port' => '6379')))->defaultValue(array(array('server' => '127.0.0.1', 'port' => '6379')))->prototype('array')->children()->scalarNode('server')->defaultValue('127.0.0.1')->end()->scalarNode('port')->defaultValue('6379')->end()->scalarNode('ttl')->end()->booleanNode('socket')->end()->end()->end()->end()->end();
     } else {
         $defaults = isset($this->driverSettings[$driver]) ? $this->driverSettings[$driver] : array();
         $node = $driverNode->addDefaultsIfNotSet()->children();
         foreach ($defaults as $setting => $default) {
             $node->scalarNode($setting)->defaultValue($default)->end();
         }
         $finalNode = $node->end();
     }
     $finalNode->end();
 }
开发者ID:Zeichen32,项目名称:TedivmStashBundle,代码行数:21,代码来源:Configuration.php

示例14: addSiteAccessSettings

 private function addSiteAccessSettings( NodeBuilder $nodeBuilder )
 {
     $nodeBuilder
         ->arrayNode( 'templating' )
             ->children()
                 ->scalarNode( 'view_layout' )
                     ->info( 'Template reference to use as pagelayout while rendering a content view in legacy' )
                     ->example( 'eZDemoBundle::pagelayout.html.twig' )
                 ->end()
                 ->scalarNode( 'module_layout' )
                     ->info( 'Template reference to use as pagelayout for legacy modules. If not specified, pagelayout from legacy will be used.' )
                 ->end()
             ->end()
         ->end()
         ->booleanNode( 'legacy_mode' )
             ->info( 'Whether to use legacy mode or not. If true, will let the legacy kernel handle url aliases.' )
         ->end();
 }
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:18,代码来源:Configuration.php

示例15: addFormSection

 /**
  * Attach the form node to the tree.
  *
  * @param NodeBuilder $nodeBuilder
  */
 private function addFormSection($nodeBuilder)
 {
     $nodeBuilder->arrayNode('form')->addDefaultsIfNotSet()->children()->arrayNode('data_class')->addDefaultsIfNotSet()->children()->scalarNode('seo_metadata')->defaultNull()->end()->end()->end()->end()->end();
 }
开发者ID:symfony-cmf,项目名称:seo-bundle,代码行数:9,代码来源:Configuration.php


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