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);
35 //Detect when no user configuration is provided
36 if ($configs === [[]]) {
37 //Prepend default config
38 $container->prependExtensionConfig(self
::getAlias(), $config);
41 //Save configuration in parameters
42 $container->setParameter(self
::getAlias(), $config);
48 public function getAlias(): string {
49 return RapsysUserBundle
::getAlias();