TreeConfigurationBuilder
extends AbstractTreeConfig
in package
A builder of configuration instances.
The builded configuration is a tree where each node may have a value. That is, considering '.' as a path node delimiter, if $config['parent.child'] is an existant path, then $config['parent'] may have it's own value without breaking the tree structure of the instance.
A builder is itself a configuration instance. It's the only one that can modify its internal state (interpolator, key delimiter). The TreeConfigurationBuilder::build() method can provides a more efficient configuration instances than the builder, due to the immutability of the internal state of the created instance.
A builder can only be created with the Configurations::builder() method factory.
Tags
Table of Contents
Methods
- build() : Configuration
- Build a new configuration instance using the builder's tree and interpolator.
- copy() : static
- Gets a new builder instance using another interpolator.
- copyOf() : self
- Makes a copy of the configuration tree.
- emptyCopyOf() : self
- Makes a copy of a configuration conserving its interpolator but not the entries.
- reset() : self
- Resets the builder to its instanciation state.
- setInterpolator() : self
- Sets the interpolator of the Configuration instance to build.
- setKeyDelimiter() : self
- Sets the key delimiter of the Configuration instance to build.
Methods
build()
Build a new configuration instance using the builder's tree and interpolator.
public
build() : Configuration
Return values
Configuration —The new instance
copy()
Gets a new builder instance using another interpolator.
public
copy([Interpolator|null $interpolator = null ]) : static
Parameters
- $interpolator : Interpolator|null = null
Tags
Return values
static —A new builder instance.
copyOf()
Makes a copy of the configuration tree.
public
copyOf(Configuration $config[, Interpolator $interpolator = null ]) : self
Parameters
- $config : Configuration
-
The configuration to copy from.
- $interpolator : Interpolator = null
-
The interpolator to use for the copy.
- (null) If not set then the copy contains the interpolated value of the configuration tree and has'nt an interpolator.
- (isset) If set then the copy uses this interpolator on the raw base value to create a new interpolated configuration. Note that the interpolator may be the same as $config, in that case it means that the same interpolation is conserved.
Return values
self —This builder.
emptyCopyOf()
Makes a copy of a configuration conserving its interpolator but not the entries.
public
emptyCopyOf(Configuration $config) : self
Parameters
- $config : Configuration
-
The configuration to copy from.
Return values
self —This builder.
reset()
Resets the builder to its instanciation state.
public
reset() : self
Return values
self —This builder
setInterpolator()
Sets the interpolator of the Configuration instance to build.
public
setInterpolator([Interpolator $interpolator = null ]) : self
This method restore any Interpolation value already stored in the builder to its base value. Then the new interpolator is applied to all the values of the builder.
Parameters
- $interpolator : Interpolator = null
-
The interpolator to assign.
Return values
self —This builder.
setKeyDelimiter()
Sets the key delimiter of the Configuration instance to build.
public
setKeyDelimiter([string $delimiter = '.' ]) : self
An access key is composed of multiple parts defining a path in the Configuration instance tree. The delimiter is a character that permits to split a key in parts defining the access path.
Parameters
- $delimiter : string = '.'