0 follower

Final Class Yiisoft\Log\ContextProvider\CompositeContextProvider

InheritanceYiisoft\Log\ContextProvider\CompositeContextProvider
ImplementsYiisoft\Log\ContextProvider\ContextProviderInterface

CompositeContextProvider allows to combine multiple context providers into one.

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( Yiisoft\Log\ContextProvider\ContextProviderInterface $providers )
$providers Yiisoft\Log\ContextProvider\ContextProviderInterface

                public function __construct(
    ContextProviderInterface ...$providers
) {
    $this->providers = $providers;
}

            
getContext() public method

public array getContext ( )

                public function getContext(): array
{
    $contexts = [];
    foreach ($this->providers as $provider) {
        $contexts[] = $provider->getContext();
    }
    return array_merge(...$contexts);
}