wallabag/src/Import/ImportCompilerPass.php

34 lines
938 B
PHP
Raw Permalink Normal View History

<?php
2024-02-19 00:30:12 +00:00
namespace Wallabag\Import;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
2017-07-01 07:52:38 +00:00
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
class ImportCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition(ImportChain::class)) {
return;
}
$definition = $container->getDefinition(
ImportChain::class
);
$taggedServices = $container->findTaggedServiceIds(
2024-02-19 23:47:53 +00:00
'wallabag.import'
);
foreach ($taggedServices as $id => $tagAttributes) {
foreach ($tagAttributes as $attributes) {
$definition->addMethodCall(
'addImport',
[new Reference($id), $attributes['alias']]
);
}
}
}
}