ScalarNodeDefinition
class ScalarNodeDefinition extends VariableNodeDefinition
This class provides a fluent interface for defining a node.
Methods
Sets an attribute on the node.
Sets the equivalent value used when the node contains null.
Sets the equivalent value used when the node contains true.
Sets the equivalent value used when the node contains false.
Sets an expression to run before the normalization.
Sets whether the node can be overwritten.
Details
in NodeDefinition at line line 48
__construct(string $name, NodeParentInterface $parent = null)
Constructor.
in NodeDefinition at line line 61
NodeDefinition|$this
setParent(NodeParentInterface $parent)
Sets the parent node.
in NodeDefinition at line line 75
NodeDefinition|$this
info(string $info)
Sets info message.
in NodeDefinition at line line 87
NodeDefinition|$this
example(string|array $example)
Sets example configuration.
in NodeDefinition at line line 100
NodeDefinition|$this
attribute(string $key, mixed $value)
Sets an attribute on the node.
in NodeDefinition at line line 112
NodeParentInterface|null
end()
Returns the parent node.
in NodeDefinition at line line 124
NodeInterface
getNode(bool $forceRootNode = false)
Creates the node.
in NodeDefinition at line line 151
NodeDefinition|$this
defaultValue(mixed $value)
Sets the default value.
in NodeDefinition at line line 164
NodeDefinition|$this
isRequired()
Sets the node as required.
in NodeDefinition at line line 178
NodeDefinition|$this
treatNullLike(mixed $value)
Sets the equivalent value used when the node contains null.
in NodeDefinition at line line 192
NodeDefinition|$this
treatTrueLike(mixed $value)
Sets the equivalent value used when the node contains true.
in NodeDefinition at line line 206
NodeDefinition|$this
treatFalseLike(mixed $value)
Sets the equivalent value used when the node contains false.
in NodeDefinition at line line 218
NodeDefinition|$this
defaultNull()
Sets null as the default value.
in NodeDefinition at line line 228
NodeDefinition|$this
defaultTrue()
Sets true as the default value.
in NodeDefinition at line line 238
NodeDefinition|$this
defaultFalse()
Sets false as the default value.
in NodeDefinition at line line 248
ExprBuilder
beforeNormalization()
Sets an expression to run before the normalization.
in NodeDefinition at line line 258
NodeDefinition|$this
cannotBeEmpty()
Denies the node value being empty.
in NodeDefinition at line line 274
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.
in NodeDefinition at line line 286
NodeDefinition|$this
cannotBeOverwritten(bool $deny = true)
Sets whether the node can be overwritten.