| @@ 12-31 (lines=20) @@ | ||
| 9 | /** |
|
| 10 | * @author Kevin Bond <[email protected]> |
|
| 11 | */ |
|
| 12 | class AdditionalReporterCompilerPass implements CompilerPassInterface |
|
| 13 | { |
|
| 14 | public function process(ContainerBuilder $container) |
|
| 15 | { |
|
| 16 | if (false === $container->hasParameter('liip_monitor.runners')) { |
|
| 17 | return; |
|
| 18 | } |
|
| 19 | ||
| 20 | foreach ($container->getParameter('liip_monitor.runners') as $runnerServiceId) { |
|
| 21 | $definition = $container->getDefinition($runnerServiceId); |
|
| 22 | ||
| 23 | foreach ($container->findTaggedServiceIds('liip_monitor.additional_reporter') as $id => $tags) { |
|
| 24 | foreach ($tags as $attributes) { |
|
| 25 | $alias = empty($attributes['alias']) ? $id : $attributes['alias']; |
|
| 26 | $definition->addMethodCall('addAdditionalReporter', [$alias, new Reference($id)]); |
|
| 27 | } |
|
| 28 | } |
|
| 29 | } |
|
| 30 | } |
|
| 31 | } |
|
| 32 | ||
| @@ 9-28 (lines=20) @@ | ||
| 6 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
| 7 | use Symfony\Component\DependencyInjection\Reference; |
|
| 8 | ||
| 9 | class CheckCollectionTagCompilerPass implements CompilerPassInterface |
|
| 10 | { |
|
| 11 | public function process(ContainerBuilder $container) |
|
| 12 | { |
|
| 13 | if (false === $container->hasParameter('liip_monitor.default_group')) { |
|
| 14 | return; |
|
| 15 | } |
|
| 16 | ||
| 17 | $defaultGroup = $container->getParameter('liip_monitor.default_group'); |
|
| 18 | ||
| 19 | foreach ($container->findTaggedServiceIds('liip_monitor.check_collection') as $id => $tags) { |
|
| 20 | foreach ($tags as $attributes) { |
|
| 21 | $group = empty($attributes['group']) ? $defaultGroup : $attributes['group']; |
|
| 22 | ||
| 23 | $runnerDefinition = $container->getDefinition('liip_monitor.runner_'.$group); |
|
| 24 | $runnerDefinition->addMethodCall('addChecks', [new Reference($id)]); |
|
| 25 | } |
|
| 26 | } |
|
| 27 | } |
|
| 28 | } |
|
| 29 | ||