private function applyDecorators(LoggerInterface $logger, array $config)
    {
        foreach ($this->decorators as $configKey => $decoratorClassName) {
            if (!isset($config[$configKey])) {
                continue;
            }
            if (!class_exists($decoratorClassName)) {
                throw new \RuntimeException('Decorator class not found: ' . $decoratorClassName);
            }
            if (!is_subclass_of($decoratorClassName, '\Phlib\Logger\Decorator\AbstractDecorator')) {
                throw new \RuntimeException('Decorator class invalid: ' . $decoratorClassName);
            }
            /** @var \Phlib\Logger\Decorator\AbstractDecorator $logger */
            $logger = new $decoratorClassName($logger, $config[$configKey]);
        }

        return $logger;
    }
private function applyDecorators(LoggerInterface $logger, array $config)
    {
        foreach ($this->decorators as $configKey => $decoratorClassName) {
            if (!isset($config[$configKey])) {
                continue;
            }
            if (!class_exists($decoratorClassName)) {
                throw new \RuntimeException('Decorator class not found: ' . $decoratorClassName);
            }
            if (!is_subclass_of($decoratorClassName, '\Phlib\Logger\Decorator\AbstractDecorator')) {
                throw new \RuntimeException('Decorator class invalid: ' . $decoratorClassName);
            }
            /** @var \Phlib\Logger\Decorator\AbstractDecorator $logger */
            $logger = new $decoratorClassName($logger, $config[$configKey]);
        }

        return $logger;
    }
private function applyDecorators ( LoggerInterface $ logger , array $ config ) { foreach ( $ this -> decorators as $ configKey => $ decoratorClassName ) { if ( ! isset ( $ config [ $ configKey ] ) ) { continue ; } if ( ! class_exists ( $ decoratorClassName ) ) { throw new \ RuntimeException ( 'Decorator class not found: ' . $ decoratorClassName ) ; } if ( ! is_subclass_of ( $ decoratorClassName , '\Phlib\Logger\Decorator\AbstractDecorator' ) ) { throw new \ RuntimeException ( 'Decorator class invalid: ' . $ decoratorClassName ) ; } /** @var \Phlib\Logger\Decorator\AbstractDecorator $logger */ $ logger = new $ decoratorClassName ( $ logger , $ config [ $ configKey ] ) ; } return $ logger ; }
Apply any available decorators to the logger, if configured

@param LoggerInterface $logger
@param array $config

@return LoggerInterface
Apply any available decorators to the logger if configured