| 148 |
lars |
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\EventDispatcher\DependencyInjection;
|
|
|
13 |
|
|
|
14 |
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
|
|
15 |
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* This pass allows bundles to extend the list of event aliases.
|
|
|
19 |
*
|
|
|
20 |
* @author Alexander M. Turek <me@derrabus.de>
|
|
|
21 |
*/
|
|
|
22 |
class AddEventAliasesPass implements CompilerPassInterface
|
|
|
23 |
{
|
|
|
24 |
private array $eventAliases;
|
|
|
25 |
|
|
|
26 |
public function __construct(array $eventAliases)
|
|
|
27 |
{
|
|
|
28 |
$this->eventAliases = $eventAliases;
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
public function process(ContainerBuilder $container): void
|
|
|
32 |
{
|
|
|
33 |
$eventAliases = $container->hasParameter('event_dispatcher.event_aliases') ? $container->getParameter('event_dispatcher.event_aliases') : [];
|
|
|
34 |
|
|
|
35 |
$container->setParameter(
|
|
|
36 |
'event_dispatcher.event_aliases',
|
|
|
37 |
array_merge($eventAliases, $this->eventAliases)
|
|
|
38 |
);
|
|
|
39 |
}
|
|
|
40 |
}
|