Final Class Yiisoft\Log\ContextProvider\CompositeContextProvider
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Yiisoft\ |
CompositeContextProvider allows to combine multiple context providers into one.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| getContext() | Yiisoft\ |
Method Details
| public mixed __construct ( Yiisoft\ | ||
| $providers | Yiisoft\ |
|
public function __construct(
ContextProviderInterface ...$providers,
) {
$this->providers = $providers;
}
| public array getContext ( ) |
public function getContext(): array
{
$contexts = [];
foreach ($this->providers as $provider) {
$contexts[] = $provider->getContext();
}
return array_merge(...$contexts);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.