class BooleanNode extends ScalarNode

This node represents a Boolean value in the config tree.

Properties

protected $name from BaseNode
protected $parent from BaseNode
protected $normalizationClosures from BaseNode
protected $finalValidationClosures from BaseNode
protected $allowOverwrite from BaseNode
protected $required from BaseNode
protected $equivalentValues from BaseNode
protected $attributes from BaseNode
protected $defaultValueSet from VariableNode
protected $defaultValue from VariableNode
protected $allowEmptyValue from VariableNode

Methods

__construct(string|null $name, NodeInterface $parent = null)

No description

from BaseNode
setAttribute($key, $value)

No description

from BaseNode
getAttribute($key, $default = null)

No description

from BaseNode
hasAttribute($key)

No description

from BaseNode
getAttributes()

No description

from BaseNode
setAttributes(array $attributes)

No description

from BaseNode
removeAttribute($key)

No description

from BaseNode
setInfo(string $info)

Sets an info message.

from BaseNode
string
getInfo()

Returns info message.

from BaseNode
setExample(string|array $example)

Sets the example configuration for this node.

from BaseNode
string|array
getExample()

Retrieves the example configuration for this node.

from BaseNode
addEquivalentValue(mixed $originalValue, mixed $equivalentValue)

Adds an equivalent value.

from BaseNode
setRequired(bool $boolean)

Set this node as required.

from BaseNode
setAllowOverwrite(bool $allow)

Sets if this node can be overridden.

from BaseNode
setNormalizationClosures(array $closures)

Sets the closures used for normalization.

from BaseNode
setFinalValidationClosures(array $closures)

Sets the closures used for final validation.

from BaseNode
bool
isRequired()

Returns true when the node is required.

from BaseNode
string
getName()

Returns the name of the node.

from BaseNode
string
getPath()

Returns the path of the node.

from BaseNode
mixed
merge(mixed $leftSide, mixed $rightSide)

Merges two values together.

from BaseNode
mixed
normalize(mixed $value)

Normalizes a value.

from BaseNode
$value
preNormalize($value)

Normalizes the value before any other normalization is applied.

from BaseNode
getParent()

Returns parent node for this node.

from BaseNode
mixed
finalize(mixed $value)

Finalizes a value.

from BaseNode
validateType(mixed $value)

Validates the type of a Node.

mixed
normalizeValue(mixed $value)

Normalizes the value.

mixed
mergeValues(mixed $leftSide, mixed $rightSide)

Merges two values together.

mixed
finalizeValue(mixed $value)

Finalizes a value.

setDefaultValue($value)

No description

bool
hasDefaultValue()

Returns true when the node has a default value.

mixed
getDefaultValue()

Returns the default value of the node.

setAllowEmptyValue(bool $boolean)

Sets if this node is allowed to have an empty value.

setName(string $name)

Sets the name of the node.

bool
isValueEmpty(mixed $value)

Evaluates if the given value is to be treated as empty.

Details

in BaseNode at line 41
__construct(string|null $name, NodeInterface $parent = null)

Parameters

string|null $name The name of the node
NodeInterface $parent The parent of this node

Exceptions

InvalidArgumentException if the name contains a period

in BaseNode at line 51
setAttribute($key, $value)

Parameters

$key
$value

in BaseNode at line 56
getAttribute($key, $default = null)

Parameters

$key
$default

in BaseNode at line 61
hasAttribute($key)

Parameters

$key

in BaseNode at line 66
getAttributes()

in BaseNode at line 71
setAttributes(array $attributes)

Parameters

array $attributes

in BaseNode at line 76
removeAttribute($key)

Parameters

$key

in BaseNode at line 86
setInfo(string $info)

Sets an info message.

Parameters

string $info

in BaseNode at line 96
string getInfo()

Returns info message.

Return Value

string The info text

in BaseNode at line 106
setExample(string|array $example)

Sets the example configuration for this node.

Parameters

string|array $example

in BaseNode at line 116
string|array getExample()

Retrieves the example configuration for this node.

Return Value

string|array The example

in BaseNode at line 127
addEquivalentValue(mixed $originalValue, mixed $equivalentValue)

Adds an equivalent value.

Parameters

mixed $originalValue
mixed $equivalentValue

in BaseNode at line 137
setRequired(bool $boolean)

Set this node as required.

Parameters

bool $boolean Required node

in BaseNode at line 147
setAllowOverwrite(bool $allow)

Sets if this node can be overridden.

Parameters

bool $allow

in BaseNode at line 157
setNormalizationClosures(array $closures)

Sets the closures used for normalization.

Parameters

array $closures An array of Closures used for normalization

in BaseNode at line 167
setFinalValidationClosures(array $closures)

Sets the closures used for final validation.

Parameters

array $closures An array of Closures used for final validation

in BaseNode at line 175
bool isRequired()

Returns true when the node is required.

Return Value

bool If the node is required

in BaseNode at line 183
string getName()

Returns the name of the node.

Return Value

string The name of the node

in BaseNode at line 191
string getPath()

Returns the path of the node.

Return Value

string The node path

in BaseNode at line 205
final mixed merge(mixed $leftSide, mixed $rightSide)

Merges two values together.

Parameters

mixed $leftSide
mixed $rightSide

Return Value

mixed The merged value

Exceptions

ForbiddenOverwriteException if the configuration path cannot be overwritten
InvalidTypeException if the value type is invalid

in BaseNode at line 220
final mixed normalize(mixed $value)

Normalizes a value.

Parameters

mixed $value The value to normalize

Return Value

mixed The normalized value

Exceptions

InvalidTypeException if the value type is invalid

in BaseNode at line 250
protected $value preNormalize($value)

Normalizes the value before any other normalization is applied.

Parameters

$value

Return Value

$value The normalized array value

in BaseNode at line 260
NodeInterface|null getParent()

Returns parent node for this node.

Return Value

NodeInterface|null

in BaseNode at line 268
final mixed finalize(mixed $value)

Finalizes a value.

Parameters

mixed $value The value to finalize

Return Value

mixed The finalized value

Exceptions

InvalidTypeException if the value type is invalid
InvalidConfigurationException if the value is invalid configuration

at line 26
protected validateType(mixed $value)

Validates the type of a Node.

Parameters

mixed $value The value to validate

Exceptions

InvalidTypeException when the value is invalid

in VariableNode at line 100
protected mixed normalizeValue(mixed $value)

Normalizes the value.

Parameters

mixed $value The value to normalize

Return Value

mixed The normalized value

in VariableNode at line 108
protected mixed mergeValues(mixed $leftSide, mixed $rightSide)

Merges two values together.

Parameters

mixed $leftSide
mixed $rightSide

Return Value

mixed The merged value

in VariableNode at line 82
protected mixed finalizeValue(mixed $value)

Finalizes a value.

Parameters

mixed $value The value to finalize

Return Value

mixed The finalized value

in VariableNode at line 30
setDefaultValue($value)

Parameters

$value

in VariableNode at line 39
bool hasDefaultValue()

Returns true when the node has a default value.

Return Value

bool If the node has a default value

in VariableNode at line 47
mixed getDefaultValue()

Returns the default value of the node.

Return Value

mixed The default value

Exceptions

RuntimeException if the node has no default value

in VariableNode at line 59
setAllowEmptyValue(bool $boolean)

Sets if this node is allowed to have an empty value.

Parameters

bool $boolean True if this entity will accept empty values

in VariableNode at line 67
setName(string $name)

Sets the name of the node.

Parameters

string $name The name of the node

at line 42
protected bool isValueEmpty(mixed $value)

Evaluates if the given value is to be treated as empty.

By default, PHP's empty() function is used to test for emptiness. This method may be overridden by subtypes to better match their understanding of empty data.

Parameters

mixed $value

Return Value

bool