2015-12-31 11:24:46 +01:00
|
|
|
<?php
|
|
|
|
|
|
2023-12-31 18:21:09 +01:00
|
|
|
namespace Wallabag\CoreBundle\Import;
|
2015-12-31 11:24:46 +01:00
|
|
|
|
|
|
|
|
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
2017-07-01 09:52:38 +02:00
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
2015-12-31 11:24:46 +01:00
|
|
|
use Symfony\Component\DependencyInjection\Reference;
|
|
|
|
|
|
|
|
|
|
class ImportCompilerPass implements CompilerPassInterface
|
|
|
|
|
{
|
|
|
|
|
public function process(ContainerBuilder $container)
|
|
|
|
|
{
|
2022-04-24 17:24:24 +02:00
|
|
|
if (!$container->hasDefinition(ImportChain::class)) {
|
2015-12-31 11:24:46 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$definition = $container->getDefinition(
|
2022-04-24 17:24:24 +02:00
|
|
|
ImportChain::class
|
2015-12-31 11:24:46 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$taggedServices = $container->findTaggedServiceIds(
|
2024-01-01 17:15:20 +01:00
|
|
|
'wallabag_core.import'
|
2015-12-31 11:24:46 +01:00
|
|
|
);
|
|
|
|
|
foreach ($taggedServices as $id => $tagAttributes) {
|
|
|
|
|
foreach ($tagAttributes as $attributes) {
|
|
|
|
|
$definition->addMethodCall(
|
|
|
|
|
'addImport',
|
|
|
|
|
[new Reference($id), $attributes['alias']]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|