IntegerNodeDefinition
class IntegerNodeDefinition extends NumericNodeDefinition
This class provides a fluent interface for defining an integer node.
Methods
__construct(string $name, NodeParentInterface $parent = null) Constructor | from NodeDefinition | |
NodeDefinition | setParent(NodeParentInterface $parent) Sets the parent node. | from NodeDefinition |
NodeDefinition | info(string $info) Sets info message. | from NodeDefinition |
NodeDefinition | example(string|array $example) Sets example configuration. | from NodeDefinition |
NodeDefinition | attribute(string $key, mixed $value) Sets an attribute on the node. | from NodeDefinition |
NodeParentInterface | end() Returns the parent node. | from NodeDefinition |
NodeInterface | getNode(Boolean $forceRootNode = false) Creates the node. | from NodeDefinition |
NodeDefinition | defaultValue(mixed $value) Sets the default value. | from NodeDefinition |
NodeDefinition | isRequired() Sets the node as required. | from NodeDefinition |
NodeDefinition | treatNullLike(mixed $value) Sets the equivalent value used when the node contains null. | from NodeDefinition |
NodeDefinition | treatTrueLike(mixed $value) Sets the equivalent value used when the node contains true. | from NodeDefinition |
NodeDefinition | treatFalseLike(mixed $value) Sets the equivalent value used when the node contains false. | from NodeDefinition |
NodeDefinition | defaultNull() Sets null as the default value. | from NodeDefinition |
NodeDefinition | defaultTrue() Sets true as the default value. | from NodeDefinition |
NodeDefinition | defaultFalse() Sets false as the default value. | from NodeDefinition |
ExprBuilder | beforeNormalization() Sets an expression to run before the normalization. | from NodeDefinition |
NodeDefinition | cannotBeEmpty() Denies the node value being empty. | from NodeDefinition |
ExprBuilder | validate() Sets an expression to run for the validation. | from NodeDefinition |
NodeDefinition | cannotBeOverwritten(Boolean $deny = true) Sets whether the node can be overwritten. | from NodeDefinition |
NumericNodeDefinition | max(mixed $max) Ensures that the value is smaller than the given reference. | from NumericNodeDefinition |
NumericNodeDefinition | min(mixed $min) Ensures that the value is bigger than the given reference. | from NumericNodeDefinition |
Details
__construct(string $name, NodeParentInterface $parent = null)
Constructor
Parameters
string | $name | The name of the node |
NodeParentInterface | $parent | The parent |
NodeDefinition setParent(NodeParentInterface $parent)
Sets the parent node.
Parameters
NodeParentInterface | $parent | The parent |
Return Value
NodeDefinition |
NodeDefinition info(string $info)
Sets info message.
Parameters
string | $info | The info text |
Return Value
NodeDefinition |
NodeDefinition example(string|array $example)
Sets example configuration.
Parameters
string|array | $example |
Return Value
NodeDefinition |
NodeDefinition attribute(string $key, mixed $value)
Sets an attribute on the node.
Parameters
string | $key | |
mixed | $value |
Return Value
NodeDefinition |
NodeParentInterface end()
Returns the parent node.
Return Value
NodeParentInterface | The builder of the parent node |
NodeInterface getNode(Boolean $forceRootNode = false)
Creates the node.
Parameters
Boolean | $forceRootNode | Whether to force this node as the root node |
Return Value
NodeInterface |
NodeDefinition defaultValue(mixed $value)
Sets the default value.
Parameters
mixed | $value | The default value |
Return Value
NodeDefinition |
NodeDefinition isRequired()
Sets the node as required.
Return Value
NodeDefinition |
NodeDefinition treatNullLike(mixed $value)
Sets the equivalent value used when the node contains null.
Parameters
mixed | $value |
Return Value
NodeDefinition |
NodeDefinition treatTrueLike(mixed $value)
Sets the equivalent value used when the node contains true.
Parameters
mixed | $value |
Return Value
NodeDefinition |
NodeDefinition treatFalseLike(mixed $value)
Sets the equivalent value used when the node contains false.
Parameters
mixed | $value |
Return Value
NodeDefinition |
NodeDefinition defaultNull()
Sets null as the default value.
Return Value
NodeDefinition |
NodeDefinition defaultTrue()
Sets true as the default value.
Return Value
NodeDefinition |
NodeDefinition defaultFalse()
Sets false as the default value.
Return Value
NodeDefinition |
ExprBuilder beforeNormalization()
Sets an expression to run before the normalization.
Return Value
ExprBuilder |
NodeDefinition cannotBeEmpty()
Denies the node value being empty.
Return Value
NodeDefinition |
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 cannotBeOverwritten(Boolean $deny = true)
Sets whether the node can be overwritten.
Parameters
Boolean | $deny | Whether the overwriting is forbidden or not |
Return Value
NodeDefinition |
NumericNodeDefinition max(mixed $max)
Ensures that the value is smaller than the given reference.
Parameters
mixed | $max |
Return Value
NumericNodeDefinition |
Exceptions
InvalidArgumentException | when the constraint is inconsistent |
NumericNodeDefinition min(mixed $min)
Ensures that the value is bigger than the given reference.
Parameters
mixed | $min |
Return Value
NumericNodeDefinition |
Exceptions
InvalidArgumentException | when the constraint is inconsistent |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Component/Config/Definition/Builder/IntegerNodeDefinition.html