BaseNode

class BaseNode implements NodeInterface

The base node class.

Methods

__construct(string $name, NodeInterface $parent = null)
setAttribute($key, $value)
getAttribute($key, $default = null)
hasAttribute($key)
getAttributes()
setAttributes(array $attributes)
removeAttribute($key)
setInfo(string $info)

Sets an info message.

string getInfo()

Returns 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.

setRequired(bool $boolean)

Set this node as required.

setDeprecated(string|null $message)

Sets this node as deprecated.

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()

Checks if this 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 this node.

string getPath()

Retrieves the path of this node.

mixed merge(mixed $leftSide, mixed $rightSide)

Merges two values together.

mixed normalize(mixed $value)

Normalizes a value, applying all normalization closures.

NodeInterface|null getParent()

Returns parent node for this node.

mixed finalize(mixed $value)

Finalizes a value, applying all finalization closures.

Details

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

Parameters

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

Exceptions

InvalidArgumentException if the name contains a period

setAttribute($key, $value)

Parameters

$key
$value

getAttribute($key, $default = null)

Parameters

$key
$default

hasAttribute($key)

Parameters

$key

getAttributes()

setAttributes(array $attributes)

Parameters

array $attributes

removeAttribute($key)

Parameters

$key

setInfo(string $info)

Sets an info message.

Parameters

string $info

string getInfo()

Returns info message.

Return Value

string The info text

setExample(string|array $example)

Sets the example configuration for this node.

Parameters

string|array $example

string|array getExample()

Retrieves the example configuration for this node.

Return Value

string|array The example

addEquivalentValue(mixed $originalValue, mixed $equivalentValue)

Adds an equivalent value.

Parameters

mixed $originalValue
mixed $equivalentValue

setRequired(bool $boolean)

Set this node as required.

Parameters

bool $boolean Required node

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.

Parameters

string|null $message Deprecated message

setAllowOverwrite(bool $allow)

Sets if this node can be overridden.

Parameters

bool $allow

setNormalizationClosures(array $closures)

Sets the closures used for normalization.

Parameters

array $closures An array of Closures used for normalization

setFinalValidationClosures(array $closures)

Sets the closures used for final validation.

Parameters

array $closures An array of Closures used for final validation

bool isRequired()

Checks if this node is required.

Return Value

bool If the node is required

bool isDeprecated()

Checks if this node is deprecated.

Return Value

bool

string getDeprecationMessage(string $node, string $path)

Returns the deprecated message.

Parameters

string $node the configuration node name
string $path the path of the node

Return Value

string

string getName()

Returns the name of this node.

Return Value

string The name of the node

string getPath()

Retrieves the path of this node.

Return Value

string The node path

final mixed merge(mixed $leftSide, mixed $rightSide)

Merges two values together.

Parameters

mixed $leftSide
mixed $rightSide

Return Value

mixed The merged values

Exceptions

ForbiddenOverwriteException

final mixed normalize(mixed $value)

Normalizes a value, applying all normalization closures.

Parameters

mixed $value The value to normalize

Return Value

mixed The normalized value

NodeInterface|null getParent()

Returns parent node for this node.

Return Value

NodeInterface|null

final mixed finalize(mixed $value)

Finalizes a value, applying all finalization closures.

Parameters

mixed $value The value to finalize

Return Value

mixed The finalized value

Exceptions

Exception
InvalidConfigurationException

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Component/Config/Definition/BaseNode.html