| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
namespace Symfony\Component\Translation\DependencyInjection; |
| 13 |
|
| 14 |
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; |
| 15 |
use Symfony\Component\DependencyInjection\ContainerBuilder; |
| 16 |
use Symfony\Component\DependencyInjection\Reference; |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
class TranslationExtractorPass implements CompilerPassInterface |
| 22 |
{ |
| 23 |
public function process(ContainerBuilder $container): void |
| 24 |
{ |
| 25 |
if (!$container->hasDefinition('translation.extractor')) { |
| 26 |
return; |
| 27 |
} |
| 28 |
|
| 29 |
$definition = $container->getDefinition('translation.extractor'); |
| 30 |
|
| 31 |
foreach ($container->findTaggedServiceIds('translation.extractor', true) as $id => $attributes) { |
| 32 |
$definition->addMethodCall('addExtractor', [$attributes[0]['alias'] ?? $id, new Reference($id)]); |
| 33 |
} |
| 34 |
} |
| 35 |
} |