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