2015-12-31 10:24:46 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Wallabag\ImportBundle\Import;
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
if (!$container->hasDefinition('wallabag_import.chain')) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$definition = $container->getDefinition(
|
|
|
|
'wallabag_import.chain'
|
|
|
|
);
|
|
|
|
|
|
|
|
$taggedServices = $container->findTaggedServiceIds(
|
|
|
|
'wallabag_import.import'
|
|
|
|
);
|
|
|
|
foreach ($taggedServices as $id => $tagAttributes) {
|
|
|
|
foreach ($tagAttributes as $attributes) {
|
|
|
|
$definition->addMethodCall(
|
|
|
|
'addImport',
|
|
|
|
[new Reference($id), $attributes['alias']]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|