Context for configuration files
In configuration files, you can use a context to configure and build a container.
TIP
A detailed description and usage examples can be found in the section "Context for configuration files."
WARNING
Values for previously added contexts may be overwritten if the context names match.
addConfiguratorContexts()
The addConfiguratorContexts() method passes a collection of contexts for configuration files.
Method signature:
php
\Kaspi\DiContainer\Interfaces\DiContainerBuilder::addConfiguratorContexts(
iterable $contexts
): staticParameters:
$contexts– a key-value collection, where the key is the name of the context.
setConfiguratorContext()
The setConfiguratorContext() method passes a named context for configuration files.
Method signature:
php
\Kaspi\DiContainer\Interfaces\DiContainerBuilder::setConfiguratorContext(
string $name,
mixed $context
): staticParameters:
$name– the name of the context (a non-empty string).$context– the value of the context.