NodeDefinition
class NodeDefinition implements NodeParentInterface
This class provides a fluent interface for defining a node.
Methods
Sets info message.
Sets example configuration.
Sets an attribute on the node.
Returns the parent node.
Creates the node.
Sets the default value.
Sets the node as required.
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 null as the default value.
Sets true as the default value.
Sets false as the default value.
Sets an expression to run before the normalization.
Denies the node value being empty.
Sets an expression to run for the validation.
Sets whether the node can be overwritten.
Details
at line line 42
__construct(string $name, NodeParentInterface $parent = null)
at line line 53
$this
setParent(NodeParentInterface $parent)
Sets the parent node.
at line line 67
$this
info(string $info)
Sets info message.
at line line 79
$this
example(string|array $example)
Sets example configuration.
at line line 92
$this
attribute(string $key, mixed $value)
Sets an attribute on the node.
at line line 104
NodeParentInterface|NodeBuilder|NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition|null
end()
Returns the parent node.
at line line 116
NodeInterface
getNode(bool $forceRootNode = false)
Creates the node.
at line line 143
$this
defaultValue(mixed $value)
Sets the default value.
at line line 156
$this
isRequired()
Sets the node as required.
at line line 170
$this
treatNullLike(mixed $value)
Sets the equivalent value used when the node contains null.
at line line 184
$this
treatTrueLike(mixed $value)
Sets the equivalent value used when the node contains true.
at line line 198
$this
treatFalseLike(mixed $value)
Sets the equivalent value used when the node contains false.
at line line 210
$this
defaultNull()
Sets null as the default value.
at line line 220
$this
defaultTrue()
Sets true as the default value.
at line line 230
$this
defaultFalse()
Sets false as the default value.
at line line 240
ExprBuilder
beforeNormalization()
Sets an expression to run before the normalization.
at line line 250
$this
cannotBeEmpty()
Denies the node value being empty.
at line line 266
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.
at line line 278
$this
cannotBeOverwritten(bool $deny = true)
Sets whether the node can be overwritten.