Joomla\DI\Container::set
Method to set the key and callback to the dataStore array.
Signature
public function set(string
$key,
[mixed
$value = false,
[boolean
$shared = false,
[boolean
$protected = false]]] )
Parameters
-
$key
- Name of dataStore key to set.
-
$value
- Callable function to run or string to retrive when requesting the specified $key.
-
$shared
- True to create and store a shared instance.
-
$protected
- True to protect this item from being overwritten. Useful for services.
Returns
- Container
- This instance to support chaining.
Errors/Exceptions
-
OutOfBoundsException
- Thrown if the provided key is already set and is protected.