VariableNode
extends BaseNode
in package
implements
PrototypeNodeInterface
This node represents a value of variable type in the config tree.
This node is intended for values of arbitrary type. Any PHP type is accepted as a value.
Tags
Table of Contents
Interfaces
- PrototypeNodeInterface
- This interface must be implemented by nodes which can be used as prototypes.
Constants
- DEFAULT_PATH_SEPARATOR = '.'
Properties
- $allowEmptyValue : mixed
- $allowOverwrite : mixed
- $attributes : mixed
- $defaultValue : mixed
- $defaultValueSet : mixed
- $deprecation : mixed
- $equivalentValues : mixed
- $finalValidationClosures : mixed
- $name : mixed
- $normalizationClosures : mixed
- $parent : mixed
- $pathSeparator : mixed
- $required : mixed
- $handlingPlaceholder : mixed
- $placeholders : array<string|int, mixed>
- $placeholderUniquePrefixes : array<string|int, mixed>
Methods
- __construct() : mixed
- addEquivalentValue() : mixed
- Adds an equivalent value.
- finalize() : mixed
- Finalizes a value.
- getAttribute() : mixed
- getAttributes() : array<string|int, mixed>
- getDefaultValue() : mixed
- Returns the default value of the node.
- getDeprecation() : array<string|int, mixed>
- getExample() : string|array<string|int, mixed>|null
- Retrieves the example configuration for this node.
- getInfo() : string|null
- Returns info message.
- getName() : string
- Returns the name of the node.
- getParent() : NodeInterface|null
- Returns parent node for this node.
- getPath() : string
- Returns the path of the node.
- hasAttribute() : bool
- hasDefaultValue() : bool
- Returns true when the node has a default value.
- isDeprecated() : bool
- Checks if this node is deprecated.
- isRequired() : bool
- Returns true when the node is required.
- merge() : mixed
- Merges two values together.
- normalize() : mixed
- Normalizes a value.
- removeAttribute() : mixed
- setAllowEmptyValue() : mixed
- Sets if this node is allowed to have an empty value.
- setAllowOverwrite() : mixed
- Sets if this node can be overridden.
- setAttribute() : mixed
- setAttributes() : mixed
- setDefaultValue() : mixed
- setDeprecated() : mixed
- Sets this node as deprecated.
- setExample() : mixed
- Sets the example configuration for this node.
- setFinalValidationClosures() : mixed
- Sets the closures used for final validation.
- setInfo() : mixed
- Sets an info message.
- setName() : mixed
- Sets the name of the node.
- setNormalizationClosures() : mixed
- Sets the closures used for normalization.
- setRequired() : mixed
- Set this node as required.
- allowPlaceholders() : bool
- Tests if placeholder values are allowed for this node.
- finalizeValue() : mixed
- Finalizes a value.
- getValidPlaceholderTypes() : array<string|int, mixed>
- Gets allowed dynamic types for this node.
- isHandlingPlaceholder() : bool
- Tests if a placeholder is being handled currently.
- isValueEmpty() : bool
- Evaluates if the given value is to be treated as empty.
- mergeValues() : mixed
- Merges two values together.
- normalizeValue() : mixed
- Normalizes the value.
- preNormalize() : mixed
- Normalizes the value before any other normalization is applied.
- validateType() : mixed
- Validates the type of a Node.
- doValidateType() : void
- resolvePlaceholderValue() : mixed
Constants
DEFAULT_PATH_SEPARATOR
public
mixed
DEFAULT_PATH_SEPARATOR
= '.'
Properties
$allowEmptyValue
protected
mixed
$allowEmptyValue
= true
$allowOverwrite
protected
mixed
$allowOverwrite
= true
$attributes
protected
mixed
$attributes
= []
$defaultValue
protected
mixed
$defaultValue
$defaultValueSet
protected
mixed
$defaultValueSet
= false
$deprecation
protected
mixed
$deprecation
= []
$equivalentValues
protected
mixed
$equivalentValues
= []
$finalValidationClosures
protected
mixed
$finalValidationClosures
= []
$name
protected
mixed
$name
$normalizationClosures
protected
mixed
$normalizationClosures
= []
$parent
protected
mixed
$parent
$pathSeparator
protected
mixed
$pathSeparator
$required
protected
mixed
$required
= false
$handlingPlaceholder
private
mixed
$handlingPlaceholder
= null
$placeholders
private
static array<string|int, mixed>
$placeholders
= []
$placeholderUniquePrefixes
private
static array<string|int, mixed>
$placeholderUniquePrefixes
= []
Methods
__construct()
public
__construct(string|null $name[, NodeInterface $parent = null ][, string $pathSeparator = self::DEFAULT_PATH_SEPARATOR ]) : mixed
Parameters
- $name : string|null
- $parent : NodeInterface = null
- $pathSeparator : string = self::DEFAULT_PATH_SEPARATOR
Tags
addEquivalentValue()
Adds an equivalent value.
public
addEquivalentValue(mixed $originalValue, mixed $equivalentValue) : mixed
Parameters
- $originalValue : mixed
- $equivalentValue : mixed
finalize()
Finalizes a value.
public
final finalize(mixed $value) : mixed
Parameters
- $value : mixed
getAttribute()
public
getAttribute(string $key[, mixed $default = null ]) : mixed
Parameters
- $key : string
- $default : mixed = null
getAttributes()
public
getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getDefaultValue()
Returns the default value of the node.
public
getDefaultValue() : mixed
getDeprecation()
public
getDeprecation(string $node, string $path) : array<string|int, mixed>
Parameters
- $node : string
-
The configuration node name
- $path : string
-
The path of the node
Return values
array<string|int, mixed>getExample()
Retrieves the example configuration for this node.
public
getExample() : string|array<string|int, mixed>|null
Return values
string|array<string|int, mixed>|nullgetInfo()
Returns info message.
public
getInfo() : string|null
Return values
string|nullgetName()
Returns the name of the node.
public
getName() : string
Return values
stringgetParent()
Returns parent node for this node.
public
getParent() : NodeInterface|null
Return values
NodeInterface|nullgetPath()
Returns the path of the node.
public
getPath() : string
Return values
stringhasAttribute()
public
hasAttribute(string $key) : bool
Parameters
- $key : string
Return values
boolhasDefaultValue()
Returns true when the node has a default value.
public
hasDefaultValue() : bool
Return values
boolisDeprecated()
Checks if this node is deprecated.
public
isDeprecated() : bool
Return values
boolisRequired()
Returns true when the node is required.
public
isRequired() : bool
Return values
boolmerge()
Merges two values together.
public
final merge(mixed $leftSide, mixed $rightSide) : mixed
Parameters
- $leftSide : mixed
- $rightSide : mixed
normalize()
Normalizes a value.
public
final normalize(mixed $value) : mixed
Parameters
- $value : mixed
removeAttribute()
public
removeAttribute(string $key) : mixed
Parameters
- $key : string
setAllowEmptyValue()
Sets if this node is allowed to have an empty value.
public
setAllowEmptyValue(bool $boolean) : mixed
Parameters
- $boolean : bool
-
True if this entity will accept empty values
setAllowOverwrite()
Sets if this node can be overridden.
public
setAllowOverwrite(bool $allow) : mixed
Parameters
- $allow : bool
setAttribute()
public
setAttribute(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
setAttributes()
public
setAttributes(array<string|int, mixed> $attributes) : mixed
Parameters
- $attributes : array<string|int, mixed>
setDefaultValue()
public
setDefaultValue(mixed $value) : mixed
Parameters
- $value : mixed
setDeprecated()
Sets this node as deprecated.
public
setDeprecated(string $package, string $version[, string $message = 'The child node "%node%" at path "%path%" is deprecated.' ]) : mixed
Parameters
- $package : string
-
The name of the composer package that is triggering the deprecation
- $version : string
-
The version of the package that introduced the deprecation
- $message : string = 'The child node "%node%" at path "%path%" is deprecated.'
-
the deprecation message to use
You can use %node% and %path% placeholders in your message to display, respectively, the node name and its complete path
setExample()
Sets the example configuration for this node.
public
setExample(string|array<string|int, mixed> $example) : mixed
Parameters
- $example : string|array<string|int, mixed>
setFinalValidationClosures()
Sets the closures used for final validation.
public
setFinalValidationClosures(array<string|int, Closure> $closures) : mixed
Parameters
- $closures : array<string|int, Closure>
-
An array of Closures used for final validation
setInfo()
Sets an info message.
public
setInfo(string $info) : mixed
Parameters
- $info : string
setName()
Sets the name of the node.
public
setName(string $name) : mixed
Parameters
- $name : string
setNormalizationClosures()
Sets the closures used for normalization.
public
setNormalizationClosures(array<string|int, Closure> $closures) : mixed
Parameters
- $closures : array<string|int, Closure>
-
An array of Closures used for normalization
setRequired()
Set this node as required.
public
setRequired(bool $boolean) : mixed
Parameters
- $boolean : bool
allowPlaceholders()
Tests if placeholder values are allowed for this node.
protected
allowPlaceholders() : bool
Return values
boolfinalizeValue()
Finalizes a value.
protected
finalizeValue(mixed $value) : mixed
Parameters
- $value : mixed
getValidPlaceholderTypes()
Gets allowed dynamic types for this node.
protected
getValidPlaceholderTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>isHandlingPlaceholder()
Tests if a placeholder is being handled currently.
protected
isHandlingPlaceholder() : bool
Return values
boolisValueEmpty()
Evaluates if the given value is to be treated as empty.
protected
isValueEmpty(mixed $value) : bool
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
- $value : mixed
Tags
Return values
boolmergeValues()
Merges two values together.
protected
mergeValues(mixed $leftSide, mixed $rightSide) : mixed
Parameters
- $leftSide : mixed
- $rightSide : mixed
normalizeValue()
Normalizes the value.
protected
normalizeValue(mixed $value) : mixed
Parameters
- $value : mixed
preNormalize()
Normalizes the value before any other normalization is applied.
protected
preNormalize(mixed $value) : mixed
Parameters
- $value : mixed
validateType()
Validates the type of a Node.
protected
validateType(mixed $value) : mixed
Parameters
- $value : mixed
doValidateType()
private
doValidateType(mixed $value) : void
Parameters
- $value : mixed
resolvePlaceholderValue()
private
static resolvePlaceholderValue(mixed $value) : mixed
Parameters
- $value : mixed