class IntegerNodeDefinition extends NumericNodeDefinition

This class provides a fluent interface for defining an integer node.

Methods

__construct(string $name, NodeParentInterface $parent = null)

Constructor

setParent(NodeParentInterface $parent)

Sets the parent node.

info(string $info)

Sets info message.

example(string|array $example)

Sets example configuration.

attribute(string $key, mixed $value)

Sets an attribute on the node.

end()

Returns the parent node.

getNode(Boolean $forceRootNode = false)

Creates the node.

defaultValue(mixed $value)

Sets the default value.

isRequired()

Sets the node as required.

treatNullLike(mixed $value)

Sets the equivalent value used when the node contains null.

treatTrueLike(mixed $value)

Sets the equivalent value used when the node contains true.

treatFalseLike(mixed $value)

Sets the equivalent value used when the node contains false.

defaultNull()

Sets null as the default value.

defaultTrue()

Sets true as the default value.

defaultFalse()

Sets false as the default value.

beforeNormalization()

Sets an expression to run before the normalization.

cannotBeEmpty()

Denies the node value being empty.

validate()

Sets an expression to run for the validation.

cannotBeOverwritten(Boolean $deny = true)

Sets whether the node can be overwritten.

max(mixed $max)

Ensures that the value is smaller than the given reference.

min(mixed $min)

Ensures that the value is bigger than the given reference.

Details

in NodeDefinition at line line 47
__construct(string $name, NodeParentInterface $parent = null)

Constructor

Parameters

string $name The name of the node
NodeParentInterface $parent The parent

in NodeDefinition at line line 64
NodeDefinition setParent(NodeParentInterface $parent)

Sets the parent node.

Parameters

NodeParentInterface $parent The parent

Return Value

NodeDefinition

in NodeDefinition at line line 78
NodeDefinition info(string $info)

Sets info message.

Parameters

string $info The info text

Return Value

NodeDefinition

in NodeDefinition at line line 90
NodeDefinition example(string|array $example)

Sets example configuration.

Parameters

string|array $example

Return Value

NodeDefinition

in NodeDefinition at line line 103
NodeDefinition attribute(string $key, mixed $value)

Sets an attribute on the node.

Parameters

string $key
mixed $value

Return Value

NodeDefinition

in NodeDefinition at line line 115
NodeParentInterface end()

Returns the parent node.

Return Value

NodeParentInterface The builder of the parent node

in NodeDefinition at line line 127
NodeInterface getNode(Boolean $forceRootNode = false)

Creates the node.

Parameters

Boolean $forceRootNode Whether to force this node as the root node

Return Value

NodeInterface

in NodeDefinition at line line 154
NodeDefinition defaultValue(mixed $value)

Sets the default value.

Parameters

mixed $value The default value

Return Value

NodeDefinition

in NodeDefinition at line line 167
NodeDefinition isRequired()

Sets the node as required.

Return Value

NodeDefinition

in NodeDefinition at line line 181
NodeDefinition treatNullLike(mixed $value)

Sets the equivalent value used when the node contains null.

Parameters

mixed $value

Return Value

NodeDefinition

in NodeDefinition at line line 195
NodeDefinition treatTrueLike(mixed $value)

Sets the equivalent value used when the node contains true.

Parameters

mixed $value

Return Value

NodeDefinition

in NodeDefinition at line line 209
NodeDefinition treatFalseLike(mixed $value)

Sets the equivalent value used when the node contains false.

Parameters

mixed $value

Return Value

NodeDefinition

in NodeDefinition at line line 221
NodeDefinition defaultNull()

Sets null as the default value.

Return Value

NodeDefinition

in NodeDefinition at line line 231
NodeDefinition defaultTrue()

Sets true as the default value.

Return Value

NodeDefinition

in NodeDefinition at line line 241
NodeDefinition defaultFalse()

Sets false as the default value.

Return Value

NodeDefinition

in NodeDefinition at line line 251
ExprBuilder beforeNormalization()

Sets an expression to run before the normalization.

Return Value

ExprBuilder

in NodeDefinition at line line 261
NodeDefinition cannotBeEmpty()

Denies the node value being empty.

Return Value

NodeDefinition

in NodeDefinition at line line 277
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

in NodeDefinition at line line 289
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

in NumericNodeDefinition at line line 33
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

in NumericNodeDefinition at line line 52
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