class NodeDefinition implements NodeParentInterface
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. | |
NodeDefinition|$this | info(string $info) Sets info message. | |
NodeDefinition|$this | example(string|array $example) Sets example configuration. | |
NodeDefinition|$this | attribute(string $key, mixed $value) Sets an attribute on the node. | |
NodeParentInterface|NodeBuilder|NodeDefinition|null | end() Returns the parent node. | |
NodeInterface | getNode(bool $forceRootNode = false) Creates the node. | |
NodeDefinition|$this | defaultValue(mixed $value) Sets the default value. | |
NodeDefinition|$this | isRequired() Sets the node as required. | |
NodeDefinition|$this | treatNullLike(mixed $value) Sets the equivalent value used when the node contains null. | |
NodeDefinition|$this | treatTrueLike(mixed $value) Sets the equivalent value used when the node contains true. | |
NodeDefinition|$this | treatFalseLike(mixed $value) Sets the equivalent value used when the node contains false. | |
NodeDefinition|$this | defaultNull() Sets null as the default value. | |
NodeDefinition|$this | defaultTrue() Sets true as the default value. | |
NodeDefinition|$this | defaultFalse() Sets false as the default value. | |
ExprBuilder | beforeNormalization() Sets an expression to run before the normalization. | |
NodeDefinition|$this | cannotBeEmpty() Denies the node value being empty. | |
ExprBuilder | validate() Sets an expression to run for the validation. | |
NodeDefinition|$this | cannotBeOverwritten(bool $deny = true) Sets whether the node can be overwritten. |
Details
__construct(string $name, NodeParentInterface $parent = null)
Constructor.
NodeDefinition|$this setParent(NodeParentInterface $parent)
Sets the parent node.
NodeDefinition|$this info(string $info)
Sets info message.
NodeDefinition|$this example(string|array $example)
Sets example configuration.
NodeDefinition|$this attribute(string $key, mixed $value)
Sets an attribute on the node.
NodeParentInterface|NodeBuilder|NodeDefinition|null end()
Returns the parent node.
NodeInterface getNode(bool $forceRootNode = false)
Creates the node.
NodeDefinition|$this defaultValue(mixed $value)
Sets the default value.
NodeDefinition|$this isRequired()
Sets the node as required.
NodeDefinition|$this treatNullLike(mixed $value)
Sets the equivalent value used when the node contains null.
NodeDefinition|$this treatTrueLike(mixed $value)
Sets the equivalent value used when the node contains true.
NodeDefinition|$this treatFalseLike(mixed $value)
Sets the equivalent value used when the node contains false.
NodeDefinition|$this defaultNull()
Sets null as the default value.
NodeDefinition|$this defaultTrue()
Sets true as the default value.
NodeDefinition|$this defaultFalse()
Sets false as the default value.
ExprBuilder beforeNormalization()
Sets an expression to run before the normalization.
NodeDefinition|$this cannotBeEmpty()
Denies the node value being empty.
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.
NodeDefinition|$this cannotBeOverwritten(bool $deny = true)
Sets whether the node can be overwritten.
Please login to continue.