Skip to content

ConfigValueHolder

ConfigValueHolder is the storage class for the XmlConfigHandler

class ConfigValueHolder implements ArrayAccess, IteratorAggregate, Stringable

ImplementsArrayAccess, IteratorAggregate, Stringable
Since1.0.0
SourceConfig/ConfigValueHolder.php
MethodDescription
__get(string $name): ?ConfigValueHolderMagic getter overload.
__isset(string $name): boolisset() overload.
__toString(): stringRetrieves the string representation of this value node.
addChildren(string $name, ConfigValueHolder $children): voidAdds a named children to this value.
appendChildren(ConfigValueHolder $children): voidAdds a unnamed children to this value.
getAttribute(string $name, mixed $default = null): mixedRetrieve an attribute.
getAttributes(): array<string, mixed>Retrieve all attributes.
[`getChildren(?string $nodename = null): array<intstring, ConfigValueHolder>`](#getchildren)
[`getIterator(): ArrayIterator<intstring, ConfigValueHolder>`](#getiterator)
getName(): stringReturns the name of this value.
[`getNode(): array{name: string, attributes: array<string, mixed>, children: array<(intstring), ConfigValueHolder>, value: (string
getValue(): ?stringRetrieves the value of this value node.
hasAttribute(string $name): boolIndicates whether or not an attribute exists.
hasChildren(?string $child = null): boolChecks whether the value has children at all (no params) or whether a child with the given name exists.
offsetExists(string $offset): boolDetermines if a named child exists.
offsetGet(string $offset): ?ConfigValueHolderRetrieves a named child.
offsetSet(string $offset, ConfigValueHolder $value): voidInserts a named child.
offsetUnset(string $offset): voidDeletes a named child.
setAttribute(string $name, mixed $value): voidSet an attribute.
setName(string $name): voidSets the name of this value.
setValue(string $value): voidSet the value of this value node.

public function __get(string $name): ?ConfigValueHolder

Magic getter overload.

Name of the child.

ParameterTypeDescription
$namestringName of the child.

Returns ?ConfigValueHolder — The child, if it exists.

public function __isset(string $name): bool

isset() overload.

Name of the child.

ParameterTypeDescription
$namestringName of the child.

Returns bool — Whether or not that child exists.

public function __toString(): string

Retrieves the string representation of this value node.

This is currently only the value of the node.

Returns string — The string representation.

public function addChildren(string $name, ConfigValueHolder $children): void

Adds a named children to this value.

The child value.

ParameterTypeDescription
$namestringThe name of the child.
$childrenConfigValueHolderThe child value.

public function appendChildren(ConfigValueHolder $children): void

Adds a unnamed children to this value.

The child value.

ParameterTypeDescription
$childrenConfigValueHolderThe child value.

public function getAttribute(string $name, mixed $default = null): mixed

Retrieve an attribute.

A default attribute value.

ParameterTypeDescription
$namestringAn attribute name.
$defaultmixedA default attribute value.

Returns mixed — An attribute value, if the attribute exists, otherwise null or the given default.

public function getAttributes(): array<string, mixed>

Retrieve all attributes.

Returns array``<``string``, ``mixed``> — An associative array of attributes.

public function getChildren(?string $nodename = null): array<int|string, ConfigValueHolder>

Returns the children of this value.

Return only the childs matching this node (tag) name.

ParameterTypeDescription
$nodename?``stringReturn only the childs matching this node (tag) name.

Returns array``<``int``|``string``, ConfigValueHolder> — An array with the childs of this value.

public function getIterator(): ArrayIterator<int|string, ConfigValueHolder>

Returns an Iterator for the child nodes.

From IteratorAggregate.

Returns ArrayIterator``<``int``|``string``, ConfigValueHolder> — The iterator.

public function getName(): string

Returns the name of this value.

Returns string — The name.

public function getNode(): array{name: string, attributes: array<string, mixed>, children: array<(int | string), ConfigValueHolder>, value: (string | null)}

Retrieves the info of this value node.

Returns array{name: string, attributes: array<string, mixed>, children: array<(int | string), ConfigValueHolder>, value: (string | null)} — An array containing the info for this node.

public function getValue(): ?string

Retrieves the value of this value node.

Returns ?``string — The value of this node, or null if none has been set.

public function hasAttribute(string $name): bool

Indicates whether or not an attribute exists.

An attribute name.

ParameterTypeDescription
$namestringAn attribute name.

Returns bool — true, if the attribute exists, otherwise false.

public function hasChildren(?string $child = null): bool

Checks whether the value has children at all (no params) or whether a child with the given name exists.

The name of the child.

ParameterTypeDescription
$child?``stringThe name of the child.

Returns bool — True if children exist, false if not.

public function offsetExists(string $offset): bool

Determines if a named child exists.

Offset to check

ParameterTypeDescription
$offsetstringOffset to check

Returns bool — Whether the offset exists.

public function offsetGet(string $offset): ?ConfigValueHolder

Retrieves a named child.

Offset to retrieve

ParameterTypeDescription
$offsetstringOffset to retrieve

Returns ?ConfigValueHolder — The child value.

public function offsetSet(string $offset, ConfigValueHolder $value): void

Inserts a named child.

The child value.

ParameterTypeDescription
$offsetstringOffset to modify
$valueConfigValueHolderThe child value.

public function offsetUnset(string $offset): void

Deletes a named child.

Offset to delete.

ParameterTypeDescription
$offsetstringOffset to delete.

public function setAttribute(string $name, mixed $value): void

Set an attribute.

An attribute value.

ParameterTypeDescription
$namestringAn attribute name.
$valuemixedAn attribute value.

public function setName(string $name): void

Sets the name of this value.

The name.

ParameterTypeDescription
$namestringThe name.

public function setValue(string $value): void

Set the value of this value node.

A value.

ParameterTypeDescription
$valuestringA value.