]> Raphaël G. Git Repositories - userbundle/blob - DependencyInjection/RapsysUserExtension.php
Remove locales key
[userbundle] / DependencyInjection / RapsysUserExtension.php
1 <?php declare(strict_types=1);
2
3 /*
4 * This file is part of the Rapsys UserBundle package.
5 *
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
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 Rapsys\UserBundle\DependencyInjection;
13
14 use Symfony\Component\DependencyInjection\ContainerBuilder;
15 use Symfony\Component\DependencyInjection\Extension\Extension;
16
17 use Rapsys\UserBundle\RapsysUserBundle;
18
19 /**
20 * This is the class that loads and manages your bundle configuration.
21 *
22 * @link http://symfony.com/doc/current/cookbook/bundles/extension.html
23 */
24 class RapsysUserExtension extends Extension {
25 /**
26 * {@inheritdoc}
27 */
28 public function load(array $configs, ContainerBuilder $container): void {
29 //Load configuration
30 $configuration = $this->getConfiguration($configs, $container);
31
32 //Process the configuration to get merged config
33 $config = $this->processConfiguration($configuration, $configs);
34
35 //Detect when no user configuration is provided
36 if ($configs === [[]]) {
37 //Prepend default config
38 $container->prependExtensionConfig(self::getAlias(), $config);
39 }
40
41 //Save configuration in parameters
42 $container->setParameter(self::getAlias(), $config);
43 }
44
45 /**
46 * {@inheritdoc}
47 */
48 public function getAlias(): string {
49 return RapsysUserBundle::getAlias();
50 }
51 }