BooleanNodeDefinition
class BooleanNodeDefinition extends ScalarNodeDefinition
This class provides a fluent interface for defining a node.
Methods
__construct(string $name, NodeParentInterface $parent = null) Constructor. | ||
NodeDefinition|$this | setParent(NodeParentInterface $parent) Sets the parent node. | from NodeDefinition |
NodeDefinition|$this | info(string $info) Sets info message. | from NodeDefinition |
NodeDefinition|$this | example(string|array $example) Sets example configuration. | from NodeDefinition |
NodeDefinition|$this | attribute(string $key, mixed $value) Sets an attribute on the node. | from NodeDefinition |
NodeParentInterface|null | end() Returns the parent node. | from NodeDefinition |
NodeInterface | getNode(bool $forceRootNode = false) Creates the node. | from NodeDefinition |
NodeDefinition|$this | defaultValue(mixed $value) Sets the default value. | from NodeDefinition |
NodeDefinition|$this | isRequired() Sets the node as required. | from NodeDefinition |
NodeDefinition|$this | treatNullLike(mixed $value) Sets the equivalent value used when the node contains null. | from NodeDefinition |
NodeDefinition|$this | treatTrueLike(mixed $value) Sets the equivalent value used when the node contains true. | from NodeDefinition |
NodeDefinition|$this | treatFalseLike(mixed $value) Sets the equivalent value used when the node contains false. | from NodeDefinition |
NodeDefinition|$this | defaultNull() Sets null as the default value. | from NodeDefinition |
NodeDefinition|$this | defaultTrue() Sets true as the default value. | from NodeDefinition |
NodeDefinition|$this | defaultFalse() Sets false as the default value. | from NodeDefinition |
ExprBuilder | beforeNormalization() Sets an expression to run before the normalization. | from NodeDefinition |
NodeDefinition|$this | cannotBeEmpty() Denies the node value being empty. | |
ExprBuilder | validate() Sets an expression to run for the validation. | from NodeDefinition |
NodeDefinition|$this | cannotBeOverwritten(bool $deny = true) Sets whether the node can be overwritten. | from NodeDefinition |
Details
__construct(string $name, NodeParentInterface $parent = null)
Constructor.
Parameters
string | $name | The name of the node |
NodeParentInterface | $parent | The parent |
NodeDefinition|$this setParent(NodeParentInterface $parent)
Sets the parent node.
Parameters
NodeParentInterface | $parent | The parent |
Return Value
NodeDefinition|$this |
NodeDefinition|$this info(string $info)
Sets info message.
Parameters
string | $info | The info text |
Return Value
NodeDefinition|$this |
NodeDefinition|$this example(string|array $example)
Sets example configuration.
Parameters
string|array | $example |
Return Value
NodeDefinition|$this |
NodeDefinition|$this attribute(string $key, mixed $value)
Sets an attribute on the node.
Parameters
string | $key | |
mixed | $value |
Return Value
NodeDefinition|$this |
NodeParentInterface|null end()
Returns the parent node.
Return Value
NodeParentInterface|null | The builder of the parent node |
NodeInterface getNode(bool $forceRootNode = false)
Creates the node.
Parameters
bool | $forceRootNode | Whether to force this node as the root node |
Return Value
NodeInterface |
NodeDefinition|$this defaultValue(mixed $value)
Sets the default value.
Parameters
mixed | $value | The default value |
Return Value
NodeDefinition|$this |
NodeDefinition|$this isRequired()
Sets the node as required.
Return Value
NodeDefinition|$this |
NodeDefinition|$this treatNullLike(mixed $value)
Sets the equivalent value used when the node contains null.
Parameters
mixed | $value |
Return Value
NodeDefinition|$this |
NodeDefinition|$this treatTrueLike(mixed $value)
Sets the equivalent value used when the node contains true.
Parameters
mixed | $value |
Return Value
NodeDefinition|$this |
NodeDefinition|$this treatFalseLike(mixed $value)
Sets the equivalent value used when the node contains false.
Parameters
mixed | $value |
Return Value
NodeDefinition|$this |
NodeDefinition|$this defaultNull()
Sets null as the default value.
Return Value
NodeDefinition|$this |
NodeDefinition|$this defaultTrue()
Sets true as the default value.
Return Value
NodeDefinition|$this |
NodeDefinition|$this defaultFalse()
Sets false as the default value.
Return Value
NodeDefinition|$this |
ExprBuilder beforeNormalization()
Sets an expression to run before the normalization.
Return Value
ExprBuilder |
NodeDefinition|$this cannotBeEmpty()
Denies the node value being empty.
Return Value
NodeDefinition|$this |
ExprBuilder validate()
Sets an expression to run for the validation.
The expression receives the value of the node and must return it. It can modify it. An exception should be thrown when the node is not valid.
Return Value
ExprBuilder |
NodeDefinition|$this cannotBeOverwritten(bool $deny = true)
Sets whether the node can be overwritten.
Parameters
bool | $deny | Whether the overwriting is forbidden or not |
Return Value
NodeDefinition|$this |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.html