comparison vendor/symfony/http-kernel/DependencyInjection/ControllerArgumentValueResolverPass.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents
children
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
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
12 namespace Symfony\Component\HttpKernel\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 * Gathers and configures the argument value resolvers.
21 *
22 * @author Iltar van der Berg <kjarli@gmail.com>
23 */
24 class ControllerArgumentValueResolverPass implements CompilerPassInterface
25 {
26 use PriorityTaggedServiceTrait;
27
28 private $argumentResolverService;
29 private $argumentValueResolverTag;
30
31 public function __construct($argumentResolverService = 'argument_resolver', $argumentValueResolverTag = 'controller.argument_value_resolver')
32 {
33 $this->argumentResolverService = $argumentResolverService;
34 $this->argumentValueResolverTag = $argumentValueResolverTag;
35 }
36
37 public function process(ContainerBuilder $container)
38 {
39 if (!$container->hasDefinition($this->argumentResolverService)) {
40 return;
41 }
42
43 $container
44 ->getDefinition($this->argumentResolverService)
45 ->replaceArgument(1, new IteratorArgument($this->findAndSortTaggedServices($this->argumentValueResolverTag, $container)))
46 ;
47 }
48 }