Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / symfony / routing / DependencyInjection / RoutingResolverPass.php
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\Routing\DependencyInjection;
13
14 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15 use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
16 use Symfony\Component\DependencyInjection\ContainerBuilder;
17 use Symfony\Component\DependencyInjection\Reference;
18
19 /**
20  * Adds tagged routing.loader services to routing.resolver service.
21  *
22  * @author Fabien Potencier <fabien@symfony.com>
23  */
24 class RoutingResolverPass implements CompilerPassInterface
25 {
26     use PriorityTaggedServiceTrait;
27
28     private $resolverServiceId;
29     private $loaderTag;
30
31     public function __construct($resolverServiceId = 'routing.resolver', $loaderTag = 'routing.loader')
32     {
33         $this->resolverServiceId = $resolverServiceId;
34         $this->loaderTag = $loaderTag;
35     }
36
37     public function process(ContainerBuilder $container)
38     {
39         if (false === $container->hasDefinition($this->resolverServiceId)) {
40             return;
41         }
42
43         $definition = $container->getDefinition($this->resolverServiceId);
44
45         foreach ($this->findAndSortTaggedServices($this->loaderTag, $container) as $id) {
46             $definition->addMethodCall('addLoader', array(new Reference($id)));
47         }
48     }
49 }