VariableNodeDefinition
extends NodeDefinition
in package
This class provides a fluent interface for defining a node.
Tags
Table of Contents
Properties
- $allowEmptyValue : bool
- $attributes : array<string|int, mixed>
- $default : bool
- $defaultValue : mixed
- $deprecation : array<string|int, mixed>
- $falseEquivalent : mixed
- $merge : MergeBuilder<string|int, $this>
- $name : string|null
- $normalization : NormalizationBuilder<string|int, $this>
- $nullEquivalent : mixed
- $parent : TParent|NodeInterface
- $pathSeparator : string
- $required : bool
- $trueEquivalent : mixed
- $validation : ValidationBuilder<string|int, $this>
Methods
- __construct() : mixed
- attribute() : $this
- Sets an attribute on the node.
- beforeNormalization() : ExprBuilder<string|int, $this>
- Sets an expression to run before the normalization.
- cannotBeEmpty() : $this
- Denies the node value being empty.
- cannotBeOverwritten() : $this
- Sets whether the node can be overwritten.
- defaultFalse() : $this
- Sets false as the default value.
- defaultNull() : $this
- Sets null as the default value.
- defaultTrue() : $this
- Sets true as the default value.
- defaultValue() : $this
- Sets the default value.
- docUrl() : $this
- Sets the documentation URI, as usually put in the "@see" tag of a doc block. This can either be a URL or a file path. You can use the placeholders {package}, {version:major} and {version:minor} in the URI.
- end() : TParent
- Returns the parent node.
- example() : $this
- Sets example configuration.
- getNode() : NodeInterface
- Creates the node.
- info() : $this
- Sets info message.
- isRequired() : $this
- Sets the node as required.
- setDeprecated() : $this
- Sets the node as deprecated.
- setParent() : $this
- Sets the parent node.
- setPathSeparator() : $this
- Set PathSeparator to use.
- treatFalseLike() : $this
- Sets the equivalent value used when the node contains false.
- treatNullLike() : $this
- Sets the equivalent value used when the node contains null.
- treatTrueLike() : $this
- Sets the equivalent value used when the node contains true.
- validate() : ExprBuilder<string|int, $this>
- Sets an expression to run for the validation.
- createNode() : NodeInterface
- Instantiate and configure the node according to this definition.
- instantiateNode() : VariableNode
- merge() : MergeBuilder<string|int, $this>
- Gets the builder for merging rules.
- normalization() : NormalizationBuilder<string|int, $this>
- Gets the builder for normalization rules.
- validation() : ValidationBuilder<string|int, $this>
- Gets the builder for validation rules.
Properties
$allowEmptyValue
protected
bool
$allowEmptyValue
= true
$attributes
protected
array<string|int, mixed>
$attributes
= []
$default
protected
bool
$default
= false
$defaultValue
protected
mixed
$defaultValue
$deprecation
protected
array<string|int, mixed>
$deprecation
= []
$falseEquivalent
protected
mixed
$falseEquivalent
= false
$merge
protected
MergeBuilder<string|int, $this>
$merge
$name
protected
string|null
$name
= null
$normalization
protected
NormalizationBuilder<string|int, $this>
$normalization
$nullEquivalent
protected
mixed
$nullEquivalent
= null
$parent
protected
TParent|NodeInterface
$parent
$pathSeparator
protected
string
$pathSeparator
= \Symfony\Component\Config\Definition\BaseNode::DEFAULT_PATH_SEPARATOR
$required
protected
bool
$required
= false
$trueEquivalent
protected
mixed
$trueEquivalent
= true
$validation
protected
ValidationBuilder<string|int, $this>
$validation
Methods
__construct()
public
__construct(string|null $name[, TParent $parent = null ]) : mixed
Parameters
- $name : string|null
- $parent : TParent = null
attribute()
Sets an attribute on the node.
public
attribute(string $key, mixed $value) : $this
Parameters
- $key : string
- $value : mixed
Return values
$thisbeforeNormalization()
Sets an expression to run before the normalization.
public
beforeNormalization() : ExprBuilder<string|int, $this>
Return values
ExprBuilder<string|int, $this>cannotBeEmpty()
Denies the node value being empty.
public
cannotBeEmpty() : $this
Return values
$thiscannotBeOverwritten()
Sets whether the node can be overwritten.
public
cannotBeOverwritten([bool $deny = true ]) : $this
Parameters
- $deny : bool = true
Return values
$thisdefaultFalse()
Sets false as the default value.
public
defaultFalse() : $this
Return values
$thisdefaultNull()
Sets null as the default value.
public
defaultNull() : $this
Return values
$thisdefaultTrue()
Sets true as the default value.
public
defaultTrue() : $this
Return values
$thisdefaultValue()
Sets the default value.
public
defaultValue(mixed $value) : $this
Parameters
- $value : mixed
Return values
$thisdocUrl()
Sets the documentation URI, as usually put in the "@see" tag of a doc block. This can either be a URL or a file path. You can use the placeholders {package}, {version:major} and {version:minor} in the URI.
public
docUrl(string $uri[, string|null $package = null ]) : $this
Parameters
- $uri : string
- $package : string|null = null
Return values
$thisend()
Returns the parent node.
public
end() : TParent
Return values
TParentexample()
Sets example configuration.
public
example(string|array<string|int, mixed> $example) : $this
Parameters
- $example : string|array<string|int, mixed>
Return values
$thisgetNode()
Creates the node.
public
getNode([bool $forceRootNode = false ]) : NodeInterface
Parameters
- $forceRootNode : bool = false
Return values
NodeInterfaceinfo()
Sets info message.
public
info(string $info) : $this
Parameters
- $info : string
Return values
$thisisRequired()
Sets the node as required.
public
isRequired() : $this
Return values
$thissetDeprecated()
Sets the node as deprecated.
public
setDeprecated(string $package, string $version[, string $message = 'The child node "%node%" at path "%path%" is deprecated.' ]) : $this
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
Return values
$thissetParent()
Sets the parent node.
public
setParent(NodeParentInterface $parent) : $this
Parameters
- $parent : NodeParentInterface
Tags
Return values
$thissetPathSeparator()
Set PathSeparator to use.
public
setPathSeparator(string $separator) : $this
Parameters
- $separator : string
Return values
$thistreatFalseLike()
Sets the equivalent value used when the node contains false.
public
treatFalseLike(mixed $value) : $this
Parameters
- $value : mixed
Return values
$thistreatNullLike()
Sets the equivalent value used when the node contains null.
public
treatNullLike(mixed $value) : $this
Parameters
- $value : mixed
Return values
$thistreatTrueLike()
Sets the equivalent value used when the node contains true.
public
treatTrueLike(mixed $value) : $this
Parameters
- $value : mixed
Return values
$thisvalidate()
Sets an expression to run for the validation.
public
validate() : ExprBuilder<string|int, $this>
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 values
ExprBuilder<string|int, $this>createNode()
Instantiate and configure the node according to this definition.
protected
createNode() : NodeInterface
Return values
NodeInterfaceinstantiateNode()
protected
instantiateNode() : VariableNode
Return values
VariableNodemerge()
Gets the builder for merging rules.
protected
merge() : MergeBuilder<string|int, $this>
Return values
MergeBuilder<string|int, $this>normalization()
Gets the builder for normalization rules.
protected
normalization() : NormalizationBuilder<string|int, $this>
Return values
NormalizationBuilder<string|int, $this>validation()
Gets the builder for validation rules.
protected
validation() : ValidationBuilder<string|int, $this>