class NumericNodeDefinition extends ScalarNodeDefinition

Abstract class that contains common code of integer and float node definitions.

Methods

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

Constructor.

$this
setParent(NodeParentInterface $parent)

Sets the parent node.

$this
info(string $info)

Sets info message.

$this
example(string|array $example)

Sets example configuration.

$this
attribute(string $key, mixed $value)

Sets an attribute on the node.

end()

Returns the parent node.

getNode(bool $forceRootNode = false)

Creates the node.

$this
defaultValue(mixed $value)

Sets the default value.

$this
isRequired()

Sets the node as required.

$this
treatNullLike(mixed $value)

Sets the equivalent value used when the node contains null.

$this
treatTrueLike(mixed $value)

Sets the equivalent value used when the node contains true.

$this
treatFalseLike(mixed $value)

Sets the equivalent value used when the node contains false.

$this
defaultNull()

Sets null as the default value.

$this
defaultTrue()

Sets true as the default value.

$this
defaultFalse()

Sets false as the default value.

beforeNormalization()

Sets an expression to run before the normalization.

$this
cannotBeEmpty()

Denies the node value being empty.

validate()

Sets an expression to run for the validation.

$this
cannotBeOverwritten(bool $deny = true)

Sets whether the node can be overwritten.

$this
max(mixed $max)

Ensures that the value is smaller than the given reference.

$this
min(mixed $min)

Ensures that the value is bigger than the given reference.

Details

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

Constructor.

Parameters

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

in NodeDefinition at line line 61
$this setParent(NodeParentInterface $parent)

Sets the parent node.

Parameters

NodeParentInterface $parent The parent

Return Value

$this

in NodeDefinition at line line 75
$this info(string $info)

Sets info message.

Parameters

string $info The info text

Return Value

$this

in NodeDefinition at line line 87
$this example(string|array $example)

Sets example configuration.

Parameters

string|array $example

Return Value

$this

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

Sets an attribute on the node.

Parameters

string $key
mixed $value

Return Value

$this

in NodeDefinition at line line 112
NodeParentInterface|NodeBuilder|NodeDefinition|null end()

Returns the parent node.

Return Value

NodeParentInterface|NodeBuilder|NodeDefinition|null The builder of the parent node

in NodeDefinition at line line 124
NodeInterface getNode(bool $forceRootNode = false)

Creates the node.

Parameters

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

Return Value

NodeInterface

in NodeDefinition at line line 151
$this defaultValue(mixed $value)

Sets the default value.

Parameters

mixed $value The default value

Return Value

$this

in NodeDefinition at line line 164
$this isRequired()

Sets the node as required.

Return Value

$this

in NodeDefinition at line line 178
$this treatNullLike(mixed $value)

Sets the equivalent value used when the node contains null.

Parameters

mixed $value

Return Value

$this

in NodeDefinition at line line 192
$this treatTrueLike(mixed $value)

Sets the equivalent value used when the node contains true.

Parameters

mixed $value

Return Value

$this

in NodeDefinition at line line 206
$this treatFalseLike(mixed $value)

Sets the equivalent value used when the node contains false.

Parameters

mixed $value

Return Value

$this

in NodeDefinition at line line 218
$this defaultNull()

Sets null as the default value.

Return Value

$this

in NodeDefinition at line line 228
$this defaultTrue()

Sets true as the default value.

Return Value

$this

in NodeDefinition at line line 238
$this defaultFalse()

Sets false as the default value.

Return Value

$this

in NodeDefinition at line line 248
ExprBuilder beforeNormalization()

Sets an expression to run before the normalization.

Return Value

ExprBuilder

at line line 69
$this cannotBeEmpty()

Denies the node value being empty.

Return Value

$this

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.

Return Value

ExprBuilder

in NodeDefinition at line line 286
$this cannotBeOverwritten(bool $deny = true)

Sets whether the node can be overwritten.

Parameters

bool $deny Whether the overwriting is forbidden or not

Return Value

$this

at line line 35
$this max(mixed $max)

Ensures that the value is smaller than the given reference.

Parameters

mixed $max

Return Value

$this

Exceptions

InvalidArgumentException when the constraint is inconsistent

at line line 54
$this min(mixed $min)

Ensures that the value is bigger than the given reference.

Parameters

mixed $min

Return Value

$this

Exceptions

InvalidArgumentException when the constraint is inconsistent