Final Class Yiisoft\Log\ContextProvider\CompositeContextProvider
| Inheritance | Yiisoft\Log\ContextProvider\CompositeContextProvider |
|---|---|
| Implements | Yiisoft\Log\ContextProvider\ContextProviderInterface |
CompositeContextProvider allows to combine multiple context providers into one.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Log\ContextProvider\CompositeContextProvider | |
| getContext() | Yiisoft\Log\ContextProvider\CompositeContextProvider |
Method Details
| public mixed __construct ( Yiisoft\Log\ContextProvider\ContextProviderInterface $providers ) | ||
| $providers | Yiisoft\Log\ContextProvider\ContextProviderInterface | |
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);
}
Signup or Login in order to comment.