FileAccess Orion

ArrayNode extends BaseNode
in package
implements PrototypeNodeInterface

Represents an Array node in the config tree.

Tags
author

Johannes M. Schmitt schmittjoh@gmail.com

Interfaces, Classes, Traits and Enums

PrototypeNodeInterface
This interface must be implemented by nodes which can be used as prototypes.

Table of Contents

DEFAULT_PATH_SEPARATOR  = '.'
$addIfNotSet  : mixed
$allowFalse  : mixed
$allowNewKeys  : mixed
$allowOverwrite  : mixed
$attributes  : mixed
$children  : mixed
$deprecationMessage  : mixed
$equivalentValues  : mixed
$finalValidationClosures  : mixed
$ignoreExtraKeys  : mixed
$name  : mixed
$normalizationClosures  : mixed
$normalizeKeys  : mixed
$parent  : mixed
$pathSeparator  : mixed
$performDeepMerging  : mixed
$removeExtraKeys  : mixed
$required  : mixed
$xmlRemappings  : mixed
$handlingPlaceholder  : mixed
$placeholders  : mixed
$placeholderUniquePrefix  : mixed
__construct()  : mixed
addChild()  : mixed
Adds a child node.
addEquivalentValue()  : mixed
Adds an equivalent value.
finalize()  : mixed
Finalizes a value.
getAttribute()  : mixed
getAttributes()  : array<string|int, mixed>
getChildren()  : array<string|int, mixed>
Retrieves the children of this node.
getDefaultValue()  : mixed
{@inheritdoc}
getDeprecationMessage()  : string
Returns the deprecated message.
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.
getXmlRemappings()  : array<string|int, mixed>
Gets the xml remappings that should be performed.
hasAttribute()  : bool
hasDefaultValue()  : mixed
{@inheritdoc}
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
setAddIfNotSet()  : mixed
Sets whether to add default values for this array if it has not been defined in any of the configuration files.
setAllowFalse()  : mixed
Sets whether false is allowed as value indicating that the array should be unset.
setAllowNewKeys()  : mixed
Sets whether new keys can be defined in subsequent configurations.
setAllowOverwrite()  : mixed
Sets if this node can be overridden.
setAttribute()  : mixed
setAttributes()  : 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.
setIgnoreExtraKeys()  : mixed
Whether extra keys should just be ignored without an exception.
setInfo()  : mixed
Sets an info message.
setName()  : mixed
Sets the name of the node.
setNormalizationClosures()  : mixed
Sets the closures used for normalization.
setNormalizeKeys()  : mixed
setPerformDeepMerging()  : mixed
Sets if deep merging should occur.
setRequired()  : mixed
Set this node as required.
setXmlRemappings()  : mixed
Sets the xml remappings that should be performed.
allowPlaceholders()  : bool
Tests if placeholder values are allowed for this node.
finalizeValue()  : mixed
Finalizes the value of this node.
getValidPlaceholderTypes()  : array<string|int, mixed>
Gets allowed dynamic types for this node.
isHandlingPlaceholder()  : bool
Tests if a placeholder is being handled currently.
mergeValues()  : mixed
Merges values together.
normalizeValue()  : mixed
Normalizes the value.
preNormalize()  : mixed
Normalizes the value before any other normalization is applied.
remapXml()  : array<string|int, mixed>
Remaps multiple singular values to a single plural value.
validateType()  : mixed
Validates the type of the value.
doValidateType()  : void
resolvePlaceholderValue()  : mixed

Constants

DEFAULT_PATH_SEPARATOR

public mixed DEFAULT_PATH_SEPARATOR = '.'

Properties

$addIfNotSet

protected mixed $addIfNotSet = false

$allowFalse

protected mixed $allowFalse = false

$allowNewKeys

protected mixed $allowNewKeys = true

$allowOverwrite

protected mixed $allowOverwrite = true

$attributes

protected mixed $attributes = []

$deprecationMessage

protected mixed $deprecationMessage = null

$equivalentValues

protected mixed $equivalentValues = []

$finalValidationClosures

protected mixed $finalValidationClosures = []

$ignoreExtraKeys

protected mixed $ignoreExtraKeys = false

$normalizationClosures

protected mixed $normalizationClosures = []

$normalizeKeys

protected mixed $normalizeKeys = true

$pathSeparator

protected mixed $pathSeparator

$performDeepMerging

protected mixed $performDeepMerging = true

$removeExtraKeys

protected mixed $removeExtraKeys = true

$required

protected mixed $required = false

$xmlRemappings

protected mixed $xmlRemappings = []

$handlingPlaceholder

private mixed $handlingPlaceholder

$placeholders

private static mixed $placeholders = []

$placeholderUniquePrefix

private static mixed $placeholderUniquePrefix

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
throws
InvalidArgumentException

if the name contains a period

Return values
mixed —

addChild()

Adds a child node.

public addChild(NodeInterface $node) : mixed
Parameters
$node : NodeInterface
Tags
throws
InvalidArgumentException

when the child node has no name

throws
InvalidArgumentException

when the child node's name is not unique

Return values
mixed —

addEquivalentValue()

Adds an equivalent value.

public addEquivalentValue(mixed $originalValue, mixed $equivalentValue) : mixed
Parameters
$originalValue : mixed
$equivalentValue : mixed
Return values
mixed —

finalize()

Finalizes a value.

public final finalize(mixed $value) : mixed
Parameters
$value : mixed

The value to finalize

Return values
mixed —

The finalized value

getAttribute()

public getAttribute(string $key[, mixed $default = null ]) : mixed
Parameters
$key : string
$default : mixed = null
Return values
mixed —

getAttributes()

public getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getChildren()

Retrieves the children of this node.

public getChildren() : array<string|int, mixed>
Return values
array<string|int, mixed> —

The children

getDefaultValue()

{@inheritdoc}

public getDefaultValue() : mixed
Return values
mixed —

getDeprecationMessage()

Returns the deprecated message.

public getDeprecationMessage(string $node, string $path) : string
Parameters
$node : string

the configuration node name

$path : string

the path of the node

Return values
string —

getExample()

Retrieves the example configuration for this node.

public getExample() : string|array<string|int, mixed>|null
Return values
string|array<string|int, mixed>|null —

The example

getInfo()

Returns info message.

public getInfo() : string|null
Return values
string|null —

The info text

getName()

Returns the name of the node.

public getName() : string
Return values
string —

The name of the node

getPath()

Returns the path of the node.

public getPath() : string
Return values
string —

The node path

getXmlRemappings()

Gets the xml remappings that should be performed.

public getXmlRemappings() : array<string|int, mixed>
Return values
array<string|int, mixed> —

an array of the form [[string, string]]

hasAttribute()

public hasAttribute(string $key) : bool
Parameters
$key : string
Return values
bool —

hasDefaultValue()

{@inheritdoc}

public hasDefaultValue() : mixed
Return values
mixed —

isDeprecated()

Checks if this node is deprecated.

public isDeprecated() : bool
Return values
bool —

isRequired()

Returns true when the node is required.

public isRequired() : bool
Return values
bool —

If the node is required

merge()

Merges two values together.

public final merge(mixed $leftSide, mixed $rightSide) : mixed
Parameters
$leftSide : mixed
$rightSide : mixed
Return values
mixed —

The merged value

normalize()

Normalizes a value.

public final normalize(mixed $value) : mixed
Parameters
$value : mixed

The value to normalize

Return values
mixed —

The normalized value

removeAttribute()

public removeAttribute(string $key) : mixed
Parameters
$key : string
Return values
mixed —

setAddIfNotSet()

Sets whether to add default values for this array if it has not been defined in any of the configuration files.

public setAddIfNotSet(bool $boolean) : mixed
Parameters
$boolean : bool
Return values
mixed —

setAllowFalse()

Sets whether false is allowed as value indicating that the array should be unset.

public setAllowFalse(bool $allow) : mixed
Parameters
$allow : bool
Return values
mixed —

setAllowNewKeys()

Sets whether new keys can be defined in subsequent configurations.

public setAllowNewKeys(bool $allow) : mixed
Parameters
$allow : bool
Return values
mixed —

setAllowOverwrite()

Sets if this node can be overridden.

public setAllowOverwrite(bool $allow) : mixed
Parameters
$allow : bool
Return values
mixed —

setAttribute()

public setAttribute(string $key, mixed $value) : mixed
Parameters
$key : string
$value : mixed
Return values
mixed —

setAttributes()

public setAttributes(array<string|int, mixed> $attributes) : mixed
Parameters
$attributes : array<string|int, mixed>
Return values
mixed —

setDeprecated()

Sets this node as deprecated.

public setDeprecated(string|null $message) : mixed

You can use %node% and %path% placeholders in your message to display, respectively, the node name and its complete path.

Parameters
$message : string|null
Return values
mixed —

setExample()

Sets the example configuration for this node.

public setExample(string|array<string|int, mixed> $example) : mixed
Parameters
$example : string|array<string|int, mixed>
Return values
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

Return values
mixed —

setIgnoreExtraKeys()

Whether extra keys should just be ignored without an exception.

public setIgnoreExtraKeys(bool $boolean[, bool $remove = true ]) : mixed
Parameters
$boolean : bool

To allow extra keys

$remove : bool = true

To remove extra keys

Return values
mixed —

setInfo()

Sets an info message.

public setInfo(string $info) : mixed
Parameters
$info : string
Return values
mixed —

setName()

Sets the name of the node.

public setName(string $name) : mixed
Parameters
$name : string
Return values
mixed —

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

Return values
mixed —

setNormalizeKeys()

public setNormalizeKeys(mixed $normalizeKeys) : mixed
Parameters
$normalizeKeys : mixed
Return values
mixed —

setPerformDeepMerging()

Sets if deep merging should occur.

public setPerformDeepMerging(bool $boolean) : mixed
Parameters
$boolean : bool
Return values
mixed —

setRequired()

Set this node as required.

public setRequired(bool $boolean) : mixed
Parameters
$boolean : bool

Required node

Return values
mixed —

setXmlRemappings()

Sets the xml remappings that should be performed.

public setXmlRemappings(array<string|int, mixed> $remappings) : mixed
Parameters
$remappings : array<string|int, mixed>

An array of the form [[string, string]]

Return values
mixed —

allowPlaceholders()

Tests if placeholder values are allowed for this node.

protected allowPlaceholders() : bool
Return values
bool —

finalizeValue()

Finalizes the value of this node.

protected finalizeValue(mixed $value) : mixed
Parameters
$value : mixed
Tags
throws
UnsetKeyException
throws
InvalidConfigurationException

if the node doesn't have enough children

Return values
mixed —

The finalised value

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
bool —

mergeValues()

Merges values together.

protected mergeValues(mixed $leftSide, mixed $rightSide) : mixed
Parameters
$leftSide : mixed

The left side to merge

$rightSide : mixed

The right side to merge

Tags
throws
InvalidConfigurationException
throws
RuntimeException
Return values
mixed —

The merged values

normalizeValue()

Normalizes the value.

protected normalizeValue(mixed $value) : mixed
Parameters
$value : mixed

The value to normalize

Tags
throws
InvalidConfigurationException
Return values
mixed —

The normalized value

preNormalize()

Normalizes the value before any other normalization is applied.

protected preNormalize(mixed $value) : mixed

Namely, you mostly have foo_bar in YAML while you have foo-bar in XML. After running this method, all keys are normalized to foo_bar.

If you have a mixed key like foo-bar_moo, it will not be altered. The key will also not be altered if the target key already exists.

Parameters
$value : mixed
Return values
mixed —

The normalized array value

remapXml()

Remaps multiple singular values to a single plural value.

protected remapXml(array<string|int, mixed> $value) : array<string|int, mixed>
Parameters
$value : array<string|int, mixed>
Return values
array<string|int, mixed> —

The remapped values

validateType()

Validates the type of the value.

protected validateType(mixed $value) : mixed
Parameters
$value : mixed
Tags
throws
InvalidTypeException
Return values
mixed —

doValidateType()

private doValidateType(mixed $value) : void
Parameters
$value : mixed
Return values
void —

resolvePlaceholderValue()

private static resolvePlaceholderValue(mixed $value) : mixed
Parameters
$value : mixed
Return values
mixed —

Search results