forked from contao/contao
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakeServicesPublicPass.php
54 lines (48 loc) · 1.37 KB
/
MakeServicesPublicPass.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
declare(strict_types=1);
/*
* This file is part of Contao.
*
* (c) Leo Feyer
*
* @license LGPL-3.0-or-later
*/
namespace Contao\CoreBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Makes services public that we need to retrieve directly.
*
* @internal
*/
class MakeServicesPublicPass implements CompilerPassInterface
{
private const IDS = [
'assets.packages',
'database_connection',
'debug.stopwatch',
'fragment.handler',
'mailer',
'monolog.logger.contao',
'security.authentication_utils',
'security.authentication.trust_resolver',
'security.encoder_factory',
'security.firewall.map',
'security.helper',
'security.logout_url_generator',
'security.password_hasher_factory',
'uri_signer',
];
public function process(ContainerBuilder $container): void
{
foreach (self::IDS as $id) {
if ($container->hasAlias($id)) {
$alias = $container->getAlias($id);
$alias->setPublic(true);
} elseif ($container->hasDefinition($id)) {
$definition = $container->getDefinition($id);
$definition->setPublic(true);
}
}
}
}