Debian Codegraph @

lib/3rdParty/composer/symfony/property-info/DependencyInjection/PropertyInfoPass.php

raw symbols SCIP
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <[email protected]>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\PropertyInfo\DependencyInjection;
13
14 use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
15 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
16 use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
17 use Symfony\Component\DependencyInjection\ContainerBuilder;
18
19 /**
20 * Adds extractors to the property_info service.
21 *
22 * @author Kévin Dunglas <[email protected]>
23 */
24 class PropertyInfoPass implements CompilerPassInterface
25 {
26 use PriorityTaggedServiceTrait;
27
28 public function process(ContainerBuilder $container): void
29 {
30 if (!$container->hasDefinition('property_info')) {
31 return;
32 }
33
34 $definition = $container->getDefinition('property_info');
35
36 $listExtractors = $this->findAndSortTaggedServices('property_info.list_extractor', $container);
37 $definition->replaceArgument(0, new IteratorArgument($listExtractors));
38
39 $typeExtractors = $this->findAndSortTaggedServices('property_info.type_extractor', $container);
40 $definition->replaceArgument(1, new IteratorArgument($typeExtractors));
41
42 $descriptionExtractors = $this->findAndSortTaggedServices('property_info.description_extractor', $container);
43 $definition->replaceArgument(2, new IteratorArgument($descriptionExtractors));
44
45 $accessExtractors = $this->findAndSortTaggedServices('property_info.access_extractor', $container);
46 $definition->replaceArgument(3, new IteratorArgument($accessExtractors));
47
48 $initializableExtractors = $this->findAndSortTaggedServices('property_info.initializable_extractor', $container);
49 $definition->setArgument(4, new IteratorArgument($initializableExtractors));
50 }
51 }