Methods summary
final public
|
#
__construct( mixed $data = null, array $delegates = null )
Create the configuration.
Create the configuration.
Parameters
- $data
Initial data. Either a filepath,
an associative array, or an Traversable iterable object.
- $delegates
- An array of delegates (config) to set.
Throws
InvalidArgumentException If $data is invalid.
|
public
array
|
#
defaults( )
Gets all default data from this store.
Gets all default data from this store.
Pre-populates new stores.
May be reimplemented in inherited classes if any default values should be defined.
Returns
array Key-value array of data
Implementation of
|
public
Charcoal\Config\AbstractConfig
|
#
merge( array|Traversable $data )
Adds new data, replacing / merging existing data with the same key.
Adds new data, replacing / merging existing data with the same key.
Parameters
Returns
Uses
Implementation of
|
public
ArrayIterator
|
#
getIterator( )
Create a new iterator from the configuration instance.
Create a new iterator from the configuration instance.
Returns
ArrayIterator
See
IteratorAggregate
Implementation of
IteratorAggregate::getIterator()
|
public
boolean
|
#
offsetExists( string $key )
Determines if this store contains the specified key and if its value is not NULL.
Determines if this store contains the specified key and if its value is not NULL.
Routine:
- If the data key is nested, the data-tree is traversed until the endpoint is found, if any;
- If the data key does NOT exist on the store, a lookup is performed on each delegate store until a key is found, if any.
Parameters
- $key
- The data key to check.
Returns
boolean TRUE if $key exists and has a value other than NULL, FALSE otherwise.
Throws
InvalidArgumentException If the $key is not a string or is a numeric value.
See
\ArrayAccess
Uses
Overrides
|
public
mixed
|
#
offsetGet( string $key )
Returns the value from the specified key on this entity.
Returns the value from the specified key on this entity.
Routine:
- If the data key is nested, the data-tree is traversed until the endpoint to return its value, if any;
- If the data key does NOT exist on the store, a lookup is performed on each delegate store until a value is found, if any.
Parameters
- $key
- The data key to retrieve.
Returns
mixed Value of the requested $key on success, NULL if the $key is not set.
Throws
InvalidArgumentException If the $key is not a string or is a numeric value.
See
\ArrayAccess
Uses
Overrides
|
public
|
#
offsetSet( string $key, mixed $value )
Assigns the value to the specified key on this entity.
Assigns the value to the specified key on this entity.
Routine:
- If the data key is nested, the data-tree is traversed until the endpoint to assign its value;
Parameters
- $key
- The data key to assign $value to.
- $value
- The data value to assign to $key.
Throws
InvalidArgumentException If the $key is not a string or is a numeric value.
See
\ArrayAccess
Uses
Used by
Overrides
|
public
|
#
offsetReplace( string $key, mixed $value )
Replaces the value from the specified key.
Replaces the value from the specified key.
Routine:
- When the value in the Config and the new value are both arrays, the method will replace their respective value recursively.
- Then or otherwise, the new value is assigned to the Config.
Parameters
- $key
- The data key to assign or merge $value to.
- $value
- The data value to assign to or merge with $key.
Throws
InvalidArgumentException If the $key is not a string or is a numeric value.
Uses
Used by
|
public
Charcoal\Config\AbstractConfig
|
#
addFile( string $path )
Adds a configuration file to the configset.
Adds a configuration file to the configset.
Natively supported file formats: INI, JSON, PHP.
Parameters
- $path
- The file to load and add.
Returns
Uses
Implementation of
|