mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
33 lines
948 B
PHP
33 lines
948 B
PHP
<?php
|
|
|
|
namespace Flasher\Symfony\DependencyInjection\Compiler;
|
|
|
|
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
use Symfony\Component\DependencyInjection\Reference;
|
|
|
|
final class ProducerCompilerPass implements CompilerPassInterface
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function process(ContainerBuilder $container)
|
|
{
|
|
if (!$container->has('notify.producer')) {
|
|
return;
|
|
}
|
|
|
|
/** @var \Flasher\Prime\Flasher $manager */
|
|
$manager = $container->findDefinition('notify.producer');
|
|
|
|
foreach ($container->findTaggedServiceIds('notify.producer') as $id => $tags) {
|
|
foreach ($tags as $attributes) {
|
|
$manager->addMethodCall('addDriver', array(
|
|
$attributes['alias'],
|
|
new Reference($id),
|
|
));
|
|
}
|
|
}
|
|
}
|
|
}
|