class
VariableNode extends BaseNode 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.
Constants
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
|
$deprecationMessage |
|
from BaseNode |
|
protected
|
$equivalentValues |
|
from BaseNode |
|
protected
|
$attributes |
|
from BaseNode |
|
protected
|
$pathSeparator |
|
from BaseNode |
|
protected
|
$defaultValueSet |
|
|
|
protected
|
$defaultValue |
|
|
|
protected
|
$allowEmptyValue |
|
|
Methods
__construct(string|null $name,
NodeInterface $parent = null, string $pathSeparator = self::DEFAULT_PATH_SEPARATOR)
No description
static void
setPlaceholder(string $placeholder, array $values)
Register possible (dummy) values for a dynamic placeholder value.
setInfo(string $info)
Sets an info message.
setExample(string|array $example)
Sets the example configuration for this node.
string|array
getExample()
Retrieves the example configuration for this node.
addEquivalentValue(mixed $originalValue, mixed $equivalentValue)
Adds an equivalent value.
setDeprecated(string|null $message)
Sets this node as deprecated.
bool
isRequired()
Returns true when the node is required.
string
getName()
Returns the name of the node.
string
getPath()
Returns the path of the node.
mixed
merge(mixed $leftSide, mixed $rightSide)
Merges two values together.
preNormalize($value)
Normalizes the value before any other normalization is applied.
getParent()
Returns parent node for this node.
mixed
finalize(mixed $value)
Finalizes a value.
mixed
mergeValues(mixed $leftSide, mixed $rightSide)
Merges two values together.
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
__construct(string|null $name, NodeInterface $parent = null, string $pathSeparator = self::DEFAULT_PATH_SEPARATOR)
static void
setPlaceholder(string $placeholder, array $values)
Register possible (dummy) values for a dynamic placeholder value.
Matching configuration values will be processed with a provided value, one by one. After a provided value is
successfully processed the configuration value is returned as is, thus preserving the placeholder.
static void
setPlaceholderUniquePrefix(string $prefix)
Sets a common prefix for dynamic placeholder values.
Matching configuration values will be skipped from being processed and are returned as is, thus preserving the
placeholder. An exact match provided by {see setPlaceholder()} might take precedence.
static void
resetPlaceholders()
Resets all current placeholders available.
setAttribute($key, $value)
getAttribute($key, $default = null)
setAttributes(array $attributes)
setExample(string|array $example)
Sets the example configuration for this node.
string|array
getExample()
Retrieves the example configuration for this node.
addEquivalentValue(mixed $originalValue, mixed $equivalentValue)
Adds an equivalent value.
setRequired(bool $boolean)
Set this node as required.
setDeprecated(string|null $message)
Sets this node as deprecated.
You can use %node% and %path% placeholders in your message to display,
respectively, the node name and its complete path.
setAllowOverwrite(bool $allow)
Sets if this node can be overridden.
setNormalizationClosures(array $closures)
Sets the closures used for normalization.
setFinalValidationClosures(array $closures)
Sets the closures used for final validation.
bool
isRequired()
Returns true when the node is required.
bool
isDeprecated()
Checks if this node is deprecated.
string
getDeprecationMessage(string $node, string $path)
Returns the deprecated message.
string
getName()
Returns the name of the node.
string
getPath()
Returns the path of the node.
final mixed
merge(mixed $leftSide, mixed $rightSide)
Merges two values together.
final mixed
normalize(mixed $value)
protected The
preNormalize($value)
Normalizes the value before any other normalization is applied.
Returns parent node for this node.
final mixed
finalize(mixed $value)
protected
validateType(mixed $value)
Validates the type of a Node.
protected mixed
normalizeValue(mixed $value)
protected mixed
mergeValues(mixed $leftSide, mixed $rightSide)
Merges two values together.
protected mixed
finalizeValue(mixed $value)
protected bool
allowPlaceholders()
Tests if placeholder values are allowed for this node.
protected bool
isHandlingPlaceholder()
Tests if a placeholder is being handled currently.
protected array
getValidPlaceholderTypes()
Gets allowed dynamic types for this node.
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.
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.