ConfigValueHolder
ConfigValueHolder is the storage class for the XmlConfigHandler
Synopsis
Section titled “Synopsis”class ConfigValueHolder implements ArrayAccess, IteratorAggregate, Stringable
| Implements | ArrayAccess, IteratorAggregate, Stringable |
| Since | 1.0.0 |
| Source | Config/ConfigValueHolder.php |
Methods
Section titled “Methods”| Method | Description |
|---|---|
__get(string $name): ?ConfigValueHolder | Magic getter overload. |
__isset(string $name): bool | isset() overload. |
__toString(): string | Retrieves the string representation of this value node. |
addChildren(string $name, ConfigValueHolder $children): void | Adds a named children to this value. |
appendChildren(ConfigValueHolder $children): void | Adds a unnamed children to this value. |
getAttribute(string $name, mixed $default = null): mixed | Retrieve an attribute. |
getAttributes(): array<string, mixed> | Retrieve all attributes. |
| [`getChildren(?string $nodename = null): array<int | string, ConfigValueHolder>`](#getchildren) |
| [`getIterator(): ArrayIterator<int | string, ConfigValueHolder>`](#getiterator) |
getName(): string | Returns the name of this value. |
| [`getNode(): array{name: string, attributes: array<string, mixed>, children: array<(int | string), ConfigValueHolder>, value: (string |
getValue(): ?string | Retrieves the value of this value node. |
hasAttribute(string $name): bool | Indicates whether or not an attribute exists. |
hasChildren(?string $child = null): bool | Checks whether the value has children at all (no params) or whether a child with the given name exists. |
offsetExists(string $offset): bool | Determines if a named child exists. |
offsetGet(string $offset): ?ConfigValueHolder | Retrieves a named child. |
offsetSet(string $offset, ConfigValueHolder $value): void | Inserts a named child. |
offsetUnset(string $offset): void | Deletes a named child. |
setAttribute(string $name, mixed $value): void | Set an attribute. |
setName(string $name): void | Sets the name of this value. |
setValue(string $value): void | Set the value of this value node. |
__get()
Section titled “__get()”public function __get(string $name): ?ConfigValueHolder
Magic getter overload.
Name of the child.
| Parameter | Type | Description |
|---|---|---|
$name | string | Name of the child. |
Returns ?ConfigValueHolder — The child, if it exists.
__isset()
Section titled “__isset()”public function __isset(string $name): bool
isset() overload.
Name of the child.
| Parameter | Type | Description |
|---|---|---|
$name | string | Name of the child. |
Returns bool — Whether or not that child exists.
__toString()
Section titled “__toString()”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.
addChildren()
Section titled “addChildren()”public function addChildren(string $name, ConfigValueHolder $children): void
Adds a named children to this value.
The child value.
| Parameter | Type | Description |
|---|---|---|
$name | string | The name of the child. |
$children | ConfigValueHolder | The child value. |
appendChildren()
Section titled “appendChildren()”public function appendChildren(ConfigValueHolder $children): void
Adds a unnamed children to this value.
The child value.
| Parameter | Type | Description |
|---|---|---|
$children | ConfigValueHolder | The child value. |
getAttribute()
Section titled “getAttribute()”public function getAttribute(string $name, mixed $default = null): mixed
Retrieve an attribute.
A default attribute value.
| Parameter | Type | Description |
|---|---|---|
$name | string | An attribute name. |
$default | mixed | A default attribute value. |
Returns mixed — An attribute value, if the attribute exists, otherwise null or the given default.
getAttributes()
Section titled “getAttributes()”public function getAttributes(): array<string, mixed>
Retrieve all attributes.
Returns array``<``string``, ``mixed``> — An associative array of attributes.
getChildren()
Section titled “getChildren()”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.
| Parameter | Type | Description |
|---|---|---|
$nodename | ?``string | Return only the childs matching this node (tag) name. |
Returns array``<``int``|``string``, ConfigValueHolder> — An array with the childs of this value.
getIterator()
Section titled “getIterator()”public function getIterator(): ArrayIterator<int|string, ConfigValueHolder>
Returns an Iterator for the child nodes.
From IteratorAggregate.
Returns ArrayIterator``<``int``|``string``, ConfigValueHolder> — The iterator.
getName()
Section titled “getName()”public function getName(): string
Returns the name of this value.
Returns string — The name.
getNode()
Section titled “getNode()”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.
getValue()
Section titled “getValue()”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.
hasAttribute()
Section titled “hasAttribute()”public function hasAttribute(string $name): bool
Indicates whether or not an attribute exists.
An attribute name.
| Parameter | Type | Description |
|---|---|---|
$name | string | An attribute name. |
Returns bool — true, if the attribute exists, otherwise false.
hasChildren()
Section titled “hasChildren()”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.
| Parameter | Type | Description |
|---|---|---|
$child | ?``string | The name of the child. |
Returns bool — True if children exist, false if not.
offsetExists()
Section titled “offsetExists()”public function offsetExists(string $offset): bool
Determines if a named child exists.
Offset to check
| Parameter | Type | Description |
|---|---|---|
$offset | string | Offset to check |
Returns bool — Whether the offset exists.
offsetGet()
Section titled “offsetGet()”public function offsetGet(string $offset): ?ConfigValueHolder
Retrieves a named child.
Offset to retrieve
| Parameter | Type | Description |
|---|---|---|
$offset | string | Offset to retrieve |
Returns ?ConfigValueHolder — The child value.
offsetSet()
Section titled “offsetSet()”public function offsetSet(string $offset, ConfigValueHolder $value): void
Inserts a named child.
The child value.
| Parameter | Type | Description |
|---|---|---|
$offset | string | Offset to modify |
$value | ConfigValueHolder | The child value. |
offsetUnset()
Section titled “offsetUnset()”public function offsetUnset(string $offset): void
Deletes a named child.
Offset to delete.
| Parameter | Type | Description |
|---|---|---|
$offset | string | Offset to delete. |
setAttribute()
Section titled “setAttribute()”public function setAttribute(string $name, mixed $value): void
Set an attribute.
An attribute value.
| Parameter | Type | Description |
|---|---|---|
$name | string | An attribute name. |
$value | mixed | An attribute value. |
setName()
Section titled “setName()”public function setName(string $name): void
Sets the name of this value.
The name.
| Parameter | Type | Description |
|---|---|---|
$name | string | The name. |
setValue()
Section titled “setValue()”public function setValue(string $value): void
Set the value of this value node.
A value.
| Parameter | Type | Description |
|---|---|---|
$value | string | A value. |