1 <?php
declare(strict_types
=1);
4 * This file is part of the Rapsys UserBundle package.
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Rapsys\UserBundle\DependencyInjection
;
14 use Symfony\Component\DependencyInjection\ContainerBuilder
;
15 use Symfony\Component\DependencyInjection\Extension\Extension
;
17 use Rapsys\UserBundle\RapsysUserBundle
;
20 * This is the class that loads and manages your bundle configuration.
22 * @link http://symfony.com/doc/current/cookbook/bundles/extension.html
24 class RapsysUserExtension
extends Extension
{
28 public function load(array $configs, ContainerBuilder
$container): void {
30 $configuration = $this->getConfiguration($configs, $container);
32 //Process the configuration to get merged config
33 $config = $this->processConfiguration($configuration, $configs);
36 $alias = RapsysUserBundle
::getAlias();
38 //Detect when no user configuration is provided
39 if ($configs === [[]]) {
40 //Prepend default config
41 $container->prependExtensionConfig($alias, $config);
44 //Save configuration in parameters
45 $container->setParameter($alias, $config);
47 //Set rapsysuser.alias key
48 $container->setParameter($alias.'.alias', $alias);
50 //Set rapsysuser.version key
51 $container->setParameter($alias.'.version', RapsysUserBundle
::getVersion());