Files
php-flasher/DependencyInjection/Compiler/PresenterCompilerPass.php
T
2020-12-06 04:03:14 +01:00

29 lines
867 B
PHP

<?php
namespace Flasher\Symfony\DependencyInjection\Compiler;
use Flasher\Prime\Presenter\PresenterManager;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
final class PresenterCompilerPass implements CompilerPassInterface
{
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
if (!$container->has('flasher.presenter_manager')) {
return;
}
/** @var PresenterManager $manager */
$manager = $container->findDefinition('flasher.presenter_manager');
foreach ($container->findTaggedServiceIds('flasher.presenter') as $id => $tags) {
$manager->addMethodCall('addDriver', array(new Reference($id)));
}
}
}