| 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 WindPressDeps\Symfony\Component\PropertyInfo\DependencyInjection; |
| 12 |
|
| 13 |
use WindPressDeps\Symfony\Component\DependencyInjection\Argument\IteratorArgument; |
| 14 |
use WindPressDeps\Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; |
| 15 |
use WindPressDeps\Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait; |
| 16 |
use WindPressDeps\Symfony\Component\DependencyInjection\ContainerBuilder; |
| 17 |
/** |
| 18 |
* Adds extractors to the property_info service. |
| 19 |
* |
| 20 |
* @author Kévin Dunglas <dunglas@gmail.com> |
| 21 |
*/ |
| 22 |
class PropertyInfoPass implements CompilerPassInterface |
| 23 |
{ |
| 24 |
use PriorityTaggedServiceTrait; |
| 25 |
private $propertyInfoService; |
| 26 |
private $listExtractorTag; |
| 27 |
private $typeExtractorTag; |
| 28 |
private $descriptionExtractorTag; |
| 29 |
private $accessExtractorTag; |
| 30 |
private $initializableExtractorTag; |
| 31 |
public function __construct(string $propertyInfoService = 'property_info', string $listExtractorTag = 'property_info.list_extractor', string $typeExtractorTag = 'property_info.type_extractor', string $descriptionExtractorTag = 'property_info.description_extractor', string $accessExtractorTag = 'property_info.access_extractor', string $initializableExtractorTag = 'property_info.initializable_extractor') |
| 32 |
{ |
| 33 |
if (0 < \func_num_args()) { |
| 34 |
trigger_deprecation('symfony/property-info', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); |
| 35 |
} |
| 36 |
$this->propertyInfoService = $propertyInfoService; |
| 37 |
$this->listExtractorTag = $listExtractorTag; |
| 38 |
$this->typeExtractorTag = $typeExtractorTag; |
| 39 |
$this->descriptionExtractorTag = $descriptionExtractorTag; |
| 40 |
$this->accessExtractorTag = $accessExtractorTag; |
| 41 |
$this->initializableExtractorTag = $initializableExtractorTag; |
| 42 |
} |
| 43 |
/** |
| 44 |
* {@inheritdoc} |
| 45 |
*/ |
| 46 |
public function process(ContainerBuilder $container) |
| 47 |
{ |
| 48 |
if (!$container->hasDefinition($this->propertyInfoService)) { |
| 49 |
return; |
| 50 |
} |
| 51 |
$definition = $container->getDefinition($this->propertyInfoService); |
| 52 |
$listExtractors = $this->findAndSortTaggedServices($this->listExtractorTag, $container); |
| 53 |
$definition->replaceArgument(0, new IteratorArgument($listExtractors)); |
| 54 |
$typeExtractors = $this->findAndSortTaggedServices($this->typeExtractorTag, $container); |
| 55 |
$definition->replaceArgument(1, new IteratorArgument($typeExtractors)); |
| 56 |
$descriptionExtractors = $this->findAndSortTaggedServices($this->descriptionExtractorTag, $container); |
| 57 |
$definition->replaceArgument(2, new IteratorArgument($descriptionExtractors)); |
| 58 |
$accessExtractors = $this->findAndSortTaggedServices($this->accessExtractorTag, $container); |
| 59 |
$definition->replaceArgument(3, new IteratorArgument($accessExtractors)); |
| 60 |
$initializableExtractors = $this->findAndSortTaggedServices($this->initializableExtractorTag, $container); |
| 61 |
$definition->setArgument(4, new IteratorArgument($initializableExtractors)); |
| 62 |
} |
| 63 |
} |
| 64 |
|