]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/ImportBundle/Import/ImportCompilerPass.php
Merge pull request #2724 from Simounet/fix/reading-time
[github/wallabag/wallabag.git] / src / Wallabag / ImportBundle / Import / ImportCompilerPass.php
CommitLineData
7019c7cf
JB
1<?php
2
3namespace Wallabag\ImportBundle\Import;
4
5use Symfony\Component\DependencyInjection\ContainerBuilder;
6use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7use Symfony\Component\DependencyInjection\Reference;
8
9class ImportCompilerPass implements CompilerPassInterface
10{
11 public function process(ContainerBuilder $container)
12 {
13 if (!$container->hasDefinition('wallabag_import.chain')) {
14 return;
15 }
16
17 $definition = $container->getDefinition(
18 'wallabag_import.chain'
19 );
20
21 $taggedServices = $container->findTaggedServiceIds(
22 'wallabag_import.import'
23 );
24 foreach ($taggedServices as $id => $tagAttributes) {
25 foreach ($tagAttributes as $attributes) {
26 $definition->addMethodCall(
27 'addImport',
28 [new Reference($id), $attributes['alias']]
29 );
30 }
31 }
32 }
33}