class PrototypedArrayNode extends ArrayNode
Represents a prototyped Array node in the config tree.
DEFAULT_PATH_SEPARATOR |
protected | $name | from BaseNode | |
protected | $parent | from BaseNode | |
protected | $normalizationClosures | from BaseNode | |
protected | $finalValidationClosures | from BaseNode | |
protected | $allowOverwrite | from BaseNode | |
protected | $required | from BaseNode | |
protected | $deprecationMessage | from BaseNode | |
protected | $equivalentValues | from BaseNode | |
protected | $attributes | from BaseNode | |
protected | $pathSeparator | from BaseNode | |
protected | $xmlRemappings | from ArrayNode | |
protected | $children | from ArrayNode | |
protected | $allowFalse | from ArrayNode | |
protected | $allowNewKeys | from ArrayNode | |
protected | $addIfNotSet | from ArrayNode | |
protected | $performDeepMerging | from ArrayNode | |
protected | $ignoreExtraKeys | from ArrayNode | |
protected | $removeExtraKeys | from ArrayNode | |
protected | $normalizeKeys | from ArrayNode | |
protected | $prototype | ||
protected | $keyAttribute | ||
protected | $removeKeyAttribute | ||
protected | $minNumberOfElements | ||
protected | $defaultValue | ||
protected | $defaultChildren |
__construct(string|null $name, NodeInterface $parent = null, string $pathSeparator = self::DEFAULT_PATH_SEPARATOR) | from BaseNode | |
static void | setPlaceholder(string $placeholder, array $values) Register possible (dummy) values for a dynamic placeholder value. | from BaseNode |
static void | setPlaceholderUniquePrefix(string $prefix) Sets a common prefix for dynamic placeholder values. | from BaseNode |
static void | resetPlaceholders() Resets all current placeholders available. | from BaseNode |
setAttribute($key, $value) | from BaseNode | |
getAttribute($key, $default = null) | from BaseNode | |
hasAttribute($key) | from BaseNode | |
getAttributes() | from BaseNode | |
setAttributes(array $attributes) | from BaseNode | |
removeAttribute($key) | from BaseNode | |
setInfo(string $info) Sets an info message. | from BaseNode | |
string | getInfo() Returns info message. | from BaseNode |
setExample(string|array $example) Sets the example configuration for this node. | from BaseNode | |
string|array | getExample() Retrieves the example configuration for this node. | from BaseNode |
addEquivalentValue(mixed $originalValue, mixed $equivalentValue) Adds an equivalent value. | from BaseNode | |
setRequired(bool $boolean) Set this node as required. | from BaseNode | |
setDeprecated(string|null $message) Sets this node as deprecated. | from BaseNode | |
setAllowOverwrite(bool $allow) Sets if this node can be overridden. | from BaseNode | |
setNormalizationClosures(array $closures) Sets the closures used for normalization. | from BaseNode | |
setFinalValidationClosures(array $closures) Sets the closures used for final validation. | from BaseNode | |
bool | isRequired() Returns true when the node is required. | from BaseNode |
bool | isDeprecated() Checks if this node is deprecated. | from BaseNode |
string | getDeprecationMessage(string $node, string $path) Returns the deprecated message. | from BaseNode |
string | getName() Returns the name of the node. | from BaseNode |
string | getPath() Returns the path of the node. | from BaseNode |
mixed | merge(mixed $leftSide, mixed $rightSide) Merges two values together. | from BaseNode |
mixed | normalize(mixed $value) Normalizes a value. | from BaseNode |
$value | preNormalize($value) Normalizes keys between the different configuration formats. | from ArrayNode |
NodeInterface|null | getParent() Returns parent node for this node. | from BaseNode |
mixed | finalize(mixed $value) Finalizes a value. | from BaseNode |
validateType(mixed $value) Validates the type of the value. | from ArrayNode | |
mixed | normalizeValue(mixed $value) Normalizes the value. | |
mixed | mergeValues(mixed $leftSide, mixed $rightSide) Merges values together. | |
mixed | finalizeValue(mixed $value) Finalizes the value of this node. | |
bool | allowPlaceholders() Tests if placeholder values are allowed for this node. | from ArrayNode |
bool | isHandlingPlaceholder() Tests if a placeholder is being handled currently. | from BaseNode |
array | getValidPlaceholderTypes() Gets allowed dynamic types for this node. | from BaseNode |
setNormalizeKeys($normalizeKeys) | from ArrayNode | |
array | getChildren() Retrieves the children of this node. | from ArrayNode |
setXmlRemappings(array $remappings) Sets the xml remappings that should be performed. | from ArrayNode | |
array | getXmlRemappings() Gets the xml remappings that should be performed. | from ArrayNode |
setAddIfNotSet(bool $boolean) Sets whether to add default values for this array if it has not been defined in any of the configuration files. | from ArrayNode | |
setAllowFalse(bool $allow) Sets whether false is allowed as value indicating that the array should be unset. | from ArrayNode | |
setAllowNewKeys(bool $allow) Sets whether new keys can be defined in subsequent configurations. | from ArrayNode | |
setPerformDeepMerging(bool $boolean) Sets if deep merging should occur. | from ArrayNode | |
setIgnoreExtraKeys(bool $boolean, bool $remove = true) Whether extra keys should just be ignore without an exception. | from ArrayNode | |
setName(string $name) Sets the name of the node. | from ArrayNode | |
bool | hasDefaultValue() Returns true when the node has a default value. | |
mixed | getDefaultValue() Returns the default value of the node. | |
addChild(NodeInterface $node) Disable adding concrete children for prototyped nodes. | ||
array | remapXml(array $value) Remaps multiple singular values to a single plural value. | from ArrayNode |
setMinNumberOfElements(int $number) Sets the minimum number of elements that a prototype based node must contain. By default this is zero, meaning no elements. | ||
setKeyAttribute(string $attribute, bool $remove = true) Sets the attribute which value is to be used as key. | ||
string | getKeyAttribute() Retrieves the name of the attribute which value should be used as key. | |
setDefaultValue(string $value) Sets the default value of this node. | ||
setAddChildrenIfNoneSet(int|string|array|null $children = array('defaults')) Adds default children when none are set. | ||
setPrototype(PrototypeNodeInterface $node) Sets the node prototype. | ||
PrototypeNodeInterface | getPrototype() Retrieves the prototype. |
string|null | $name | |
NodeInterface | $parent | |
string | $pathSeparator |
InvalidArgumentException | if the name contains a period |
Register possible (dummy) values for a dynamic placeholder value.
Matching configuration values will be processed with a provided value, one by one. After a provided value is successfully processed the configuration value is returned as is, thus preserving the placeholder.
string | $placeholder | |
array | $values |
void |
Sets a common prefix for dynamic placeholder values.
Matching configuration values will be skipped from being processed and are returned as is, thus preserving the placeholder. An exact match provided by {see setPlaceholder()} might take precedence.
string | $prefix |
void |
Resets all current placeholders available.
void |
$key | ||
$value |
$key | ||
$default |
$key |
array | $attributes |
$key |
Sets an info message.
string | $info |
Returns info message.
string | The info text |
Sets the example configuration for this node.
string|array | $example |
Retrieves the example configuration for this node.
string|array | The example |
Adds an equivalent value.
mixed | $originalValue | |
mixed | $equivalentValue |
Set this node as required.
bool | $boolean | Required node |
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.
string|null | $message | Deprecated message |
Sets if this node can be overridden.
bool | $allow |
Sets the closures used for normalization.
array | $closures | An array of Closures used for normalization |
Sets the closures used for final validation.
array | $closures | An array of Closures used for final validation |
Returns true when the node is required.
bool | If the node is required |
Checks if this node is deprecated.
bool |
Returns the deprecated message.
string | $node | the configuration node name |
string | $path | the path of the node |
string |
Returns the name of the node.
string | The name of the node |
Returns the path of the node.
string | The node path |
Merges two values together.
mixed | $leftSide | |
mixed | $rightSide |
mixed | The merged value |
ForbiddenOverwriteException | if the configuration path cannot be overwritten |
InvalidTypeException | if the value type is invalid |
Normalizes a value.
mixed | $value | The value to normalize |
mixed | The normalized value |
InvalidTypeException | if the value type is invalid |
Normalizes keys between the different configuration formats.
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.
$value |
$value | The normalized array value |
Returns parent node for this node.
NodeInterface|null |
Finalizes a value.
mixed | $value | The value to finalize |
mixed | The finalized value |
InvalidTypeException | if the value type is invalid |
InvalidConfigurationException | if the value is invalid configuration |
Validates the type of the value.
mixed | $value | The value to validate |
InvalidTypeException |
Normalizes the value.
mixed | $value | The value to normalize |
mixed | The normalized value |
InvalidConfigurationException | |
DuplicateKeyException |
Merges values together.
mixed | $leftSide | |
mixed | $rightSide |
mixed | The merged value |
InvalidConfigurationException | |
RuntimeException |
Finalizes the value of this node.
mixed | $value | The value to finalize |
mixed | The finalized value |
UnsetKeyException | |
InvalidConfigurationException | if the node doesn't have enough children |
Tests if placeholder values are allowed for this node.
bool |
Tests if a placeholder is being handled currently.
bool |
Gets allowed dynamic types for this node.
array |
$normalizeKeys |
Retrieves the children of this node.
array | The children |
Sets the xml remappings that should be performed.
array | $remappings | An array of the form array(array(string, string)) |
Gets the xml remappings that should be performed.
array | $remappings an array of the form array(array(string, string)) |
Sets whether to add default values for this array if it has not been defined in any of the configuration files.
bool | $boolean |
Sets whether false is allowed as value indicating that the array should be unset.
bool | $allow |
Sets whether new keys can be defined in subsequent configurations.
bool | $allow |
Sets if deep merging should occur.
bool | $boolean |
Whether extra keys should just be ignore without an exception.
bool | $boolean | To allow extra keys |
bool | $remove | To remove extra keys |
Sets the name of the node.
string | $name | The name of the node |
Returns true when the node has a default value.
bool | If the node has a default value |
Returns the default value of the node.
mixed | The default value |
RuntimeException | if the node has no default value |
Disable adding concrete children for prototyped nodes.
NodeInterface | $node |
Exception |
Remaps multiple singular values to a single plural value.
array | $value | The source values |
array | The remapped values |
Sets the minimum number of elements that a prototype based node must contain. By default this is zero, meaning no elements.
int | $number |
Sets the attribute which value is to be used as key.
This is useful when you have an indexed array that should be an associative array. You can select an item from within the array to be the key of the particular item. For example, if "id" is the "key", then:
array(
array('id' => 'my_name', 'foo' => 'bar'),
);
becomes
array(
'my_name' => array('foo' => 'bar'),
);
If you'd like "'id' => 'my_name'" to still be present in the resulting array, then you can set the second argument of this method to false.
string | $attribute | The name of the attribute which value is to be used as a key |
bool | $remove | Whether or not to remove the key |
Retrieves the name of the attribute which value should be used as key.
string | The name of the attribute |
Sets the default value of this node.
string | $value |
InvalidArgumentException | if the default value is not an array |
Adds default children when none are set.
int|string|array|null | $children | The number of children|The child name|The children names to be added |
Sets the node prototype.
PrototypeNodeInterface | $node |
Retrieves the prototype.
PrototypeNodeInterface | The prototype |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Config/Definition/PrototypedArrayNode.html