independent-analytics
/
vendor
/
symfony
/
translation
/
DependencyInjection
/
TranslationExtractorPass.php
TranslationDumperPass.php
1 month ago
TranslationExtractorPass.php
1 month ago
TranslatorPass.php
1 month ago
TranslatorPathsPass.php
1 month ago
TranslationExtractorPass.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <fabien@symfony.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | namespace IAWPSCOPED\Symfony\Component\Translation\DependencyInjection; |
| 12 | |
| 13 | use IAWPSCOPED\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; |
| 14 | use IAWPSCOPED\Symfony\Component\DependencyInjection\ContainerBuilder; |
| 15 | use IAWPSCOPED\Symfony\Component\DependencyInjection\Exception\RuntimeException; |
| 16 | use IAWPSCOPED\Symfony\Component\DependencyInjection\Reference; |
| 17 | /** |
| 18 | * Adds tagged translation.extractor services to translation extractor. |
| 19 | * @internal |
| 20 | */ |
| 21 | class TranslationExtractorPass implements CompilerPassInterface |
| 22 | { |
| 23 | public function process(ContainerBuilder $container) |
| 24 | { |
| 25 | if (!$container->hasDefinition('translation.extractor')) { |
| 26 | return; |
| 27 | } |
| 28 | $definition = $container->getDefinition('translation.extractor'); |
| 29 | foreach ($container->findTaggedServiceIds('translation.extractor', \true) as $id => $attributes) { |
| 30 | if (!isset($attributes[0]['alias'])) { |
| 31 | throw new RuntimeException(\sprintf('The alias for the tag "translation.extractor" of service "%s" must be set.', $id)); |
| 32 | } |
| 33 | $definition->addMethodCall('addExtractor', [$attributes[0]['alias'], new Reference($id)]); |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 |