本文整理汇总了PHP中Symfony\Component\Config\Definition\Builder\NodeDefinition::children方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeDefinition::children方法的具体用法?PHP NodeDefinition::children怎么用?PHP NodeDefinition::children使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Config\Definition\Builder\NodeDefinition
的用法示例。
在下文中一共展示了NodeDefinition::children方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addConfiguration
public function addConfiguration(NodeDefinition $node)
{
$node
->children()
->end()
;
}
示例2: getConfigTreeExtension
/**
* Generates the configuration tree builder.
*
*/
public function getConfigTreeExtension(NodeDefinition $rootNode)
{
$rootNode->children()->scalarNode('min')->isRequired()->info('Starting Number')->example('A numeric number like 1 or 1.67 or 0.87')->validate()->ifTrue(function ($v) {
return !is_numeric($v);
})->then(function ($v) {
throw new EngineException('Range::min Numeric is required');
})->end()->end()->scalarNode('max')->isRequired()->example('A numeric number like 1 or 1.67 or 0.87')->info('The maxium to use in range')->validate()->ifTrue(function ($v) {
return !is_numeric($v);
})->then(function ($v) {
throw new EngineException('Range::max Numeric is required');
})->end()->end()->scalarNode('step')->defaultValue(false)->example('1 , 1.5 , 0.6')->info('Stepping value applied on every increment, not supplied will use random')->validate()->ifTrue(function ($v) {
return !(is_numeric($v) || $v === false);
})->then(function ($v) {
throw new EngineException('Range::Step option should be numeric or bool(false) to use random step');
})->end()->end()->scalarNode('windowStep')->info('Value to add to the base after the iteration has finished (reached max)')->example(1)->defaultValue(0)->validate()->ifTrue(function ($x) {
return !is_numeric($x);
})->then(function ($x) {
throw new EngineException('Range:: windowStep must be an number');
})->end()->end()->booleanNode('random')->defaultFalse()->example('false|true')->info('Enable random step value on every loop, step param must be set to false')->end()->scalarNode('round')->defaultValue(0)->example('an integer')->info('number of places to round too')->validate()->ifTrue(function ($v) {
return !(is_integer($v) && $v > 0);
})->then(function ($v) {
throw new EngineException('Range::Round option should be a positive integer >= 0');
})->end()->end()->end();
return $rootNode;
}
示例3: addHandlersSection
/**
* @param NodeDefinition $node
* @param $name
* @param string $info block info line
* @param ConfigurationFactory[]|ArrayObject $factories
*/
private function addHandlersSection(NodeDefinition $node, $name, $info, ArrayObject &$factories)
{
$handlersNodeBuilder = $node->children()->arrayNode($name)->info($info)->useAttributeAsKey('name')->prototype('array')->performNoDeepMerging()->children();
foreach ($factories as $name => $factory) {
$factoryNode = $handlersNodeBuilder->arrayNode($name)->canBeUnset();
$factory->addConfiguration($factoryNode);
}
}
示例4: addConfiguration
public function addConfiguration(NodeDefinition $node)
{
$node
->children()
->scalarNode('client')->isRequired()->end()
->end()
;
}
示例5: getConfigTreeExtension
public function getConfigTreeExtension(NodeDefinition $rootNode)
{
$rootNode->children()->scalarNode('badOption')->treatNullLike('en')->defaultValue('en')->info('Abad option')->validate()->ifTrue(function ($v) {
return $v === 'bad';
})->then(function ($v) {
throw new InvalidConfigurationException('BadOption is equal to bad');
})->end()->end();
return $rootNode;
}
示例6: getConfigTreeExtension
/**
* Generates the configuration tree builder.
*
*/
public function getConfigTreeExtension(NodeDefinition $rootNode)
{
$rootNode->children()->booleanNode('value')->isRequired()->validate()->ifTrue(function ($v) {
return !empty($v);
})->then(function ($v) {
return (bool) $v;
})->end()->info('true or false')->example('true | false')->end()->end();
return $rootNode;
}
示例7: getConfigTreeExtension
public function getConfigTreeExtension(NodeDefinition $rootNode)
{
$rootNode->children()->scalarNode('probability')->isRequired()->info('')->example('0.3 | 0.4 | 0.5')->validate()->ifTrue(function ($v) {
return !is_numeric($v) || !($v > 0 && $v < 1);
})->then(function ($v) {
throw new EngineException('PickSelector::Probability must be between 0 and 1');
})->end()->end()->end();
return $rootNode;
}
示例8: getConfigTreeExtension
public function getConfigTreeExtension(NodeDefinition $rootNode)
{
$rootNode->children()->scalarNode('set')->isRequired()->info('The size of the set to pick from')->example('1 | 2 | 3')->validate()->ifTrue(function ($v) {
return !is_integer($v) || (int) $v < 1;
})->then(function ($v) {
throw new EngineException('RandomSelector::Set size is required and must be and integer > 0');
})->end()->end()->end();
return $rootNode;
}
示例9: configureNode
public static function configureNode(NodeDefinition $node)
{
$node->children()->arrayNode("tags")->prototype("scalar")->end()->end()->scalarNode("query")->end()->booleanNode("filter_by_run_id")->end()->integerNode("limit")->defaultValue(10)->end()->arrayNode("processed_tags")->prototype("scalar")->end()->end()->end()->validate()->ifTrue(function ($v) {
if ((!isset($v["tags"]) || count($v["tags"]) == 0) && !isset($v["query"])) {
return true;
}
return false;
})->thenInvalid("At least one of 'tags' or 'query' parameters must be defined.");
}
示例10: addConfiguration
public function addConfiguration(NodeDefinition $node)
{
$node
->children()
->scalarNode('container')->isRequired()->end()
->scalarNode('prefix')->defaultNull()->end()
->end()
;
}
示例11: addConfiguration
public function addConfiguration(NodeDefinition $node)
{
$node
->children()
->scalarNode('client')->isRequired()->end()
->scalarNode('key')->defaultValue('flysystem')->end()
->scalarNode('expires')->defaultNull()->end()
->end()
;
}
示例12: getConfigTreeExtension
/**
* Generates the configuration tree builder.
*
*/
public function getConfigTreeExtension(NodeDefinition $rootNode)
{
$rootNode->children()->scalarNode('value')->isRequired()->info('The constant value to use')->end()->scalarNode('type')->info('Cast to use')->example('string|boolean|integer|float|double')->defaultValue('integer')->validate()->ifTrue(function ($v) {
$valid_values = array(\Faker\Components\Engine\Common\Type\ConstantNumber::INTTYPE, \Faker\Components\Engine\Common\Type\ConstantNumber::STRINGTYPE, \Faker\Components\Engine\Common\Type\ConstantNumber::BOOLTYPE, \Faker\Components\Engine\Common\Type\ConstantNumber::BOOLEANTYPE, \Faker\Components\Engine\Common\Type\ConstantNumber::FLOATTYPE, \Faker\Components\Engine\Common\Type\ConstantNumber::DOUBLETYPE);
return !in_array($v, $valid_values);
})->then(function ($v) {
throw new EngineException('Constant::Type Option not in valid list');
})->end()->end()->end();
return $rootNode;
}
示例13: addConfiguration
public function addConfiguration(NodeDefinition $node)
{
$builder = $node->children();
$builder->scalarNode('provider')->end()->booleanNode('remember_me')->defaultTrue()->end()->scalarNode('success_handler')->end()->scalarNode('failure_handler')->end();
foreach (array_merge($this->options, $this->defaultSuccessHandlerOptions, $this->defaultFailureHandlerOptions) as $name => $default) {
if (is_bool($default)) {
$builder->booleanNode($name)->defaultValue($default);
} else {
$builder->scalarNode($name)->defaultValue($default);
}
}
}
示例14: addConfiguration
public function addConfiguration(NodeDefinition $node)
{
$builder = $node->children();
$builder->scalarNode('key')->isRequired()->cannotBeEmpty()->end()->scalarNode('token_provider')->end();
foreach ($this->options as $name => $value) {
if (is_bool($value)) {
$builder->booleanNode($name)->defaultValue($value);
} else {
$builder->scalarNode($name)->defaultValue($value);
}
}
}
示例15: getConfigTreeExtension
public function getConfigTreeExtension(NodeDefinition $rootNode)
{
$rootNode->children()->scalarNode('step')->isRequired()->info('The number of passes to make before alternating must be an integer')->example('1 | 2 | 3')->validate()->ifTrue(function ($v) {
return !is_integer($v) || (int) $v < 1;
})->then(function ($v) {
throw new EngineException('AlternateSelector::Step integer is required and must be > 0');
})->end()->end()->scalarNode('set')->isRequired()->info('The size of the set to alternate over')->example('1 | 2 | 3')->validate()->ifTrue(function ($v) {
return !is_integer($v) || (int) $v < 1;
})->then(function ($v) {
throw new EngineException('AlternateSelector::Set integer is required and must be > 0');
})->end()->end()->end();
return $rootNode;
}