mirror of
https://github.com/wallabag/wallabag.git
synced 2024-09-27 14:00:15 +00:00
33 lines
938 B
PHP
33 lines
938 B
PHP
<?php
|
|
|
|
namespace Wallabag\Import;
|
|
|
|
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
|
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(
|
|
'wallabag.import'
|
|
);
|
|
foreach ($taggedServices as $id => $tagAttributes) {
|
|
foreach ($tagAttributes as $attributes) {
|
|
$definition->addMethodCall(
|
|
'addImport',
|
|
[new Reference($id), $attributes['alias']]
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|