88use Symfony \Component \DependencyInjection \ContainerBuilder ;
99use Symfony \Component \DependencyInjection \Extension \Extension ;
1010
11+ use function is_array ;
12+
1113class NetgenApiPlatformExtrasExtension extends Extension
1214{
1315 /**
@@ -17,26 +19,7 @@ public function load(array $configs, ContainerBuilder $container): void
1719 {
1820 $ configuration = $ this ->getConfiguration ($ configs , $ container );
1921 $ config = $ this ->processConfiguration ($ configuration , $ configs );
20-
21- if (($ config ['http_cache ' ]['enabled ' ] ?? false ) === true ) {
22- // TODO: register http cache related services
23- }
24-
25- if (($ config ['schema_decoration ' ]['enabled ' ] ?? false ) === true ) {
26- // TODO: register schema decoration related services
27- }
28-
29- if (($ config ['simple_normalizer ' ]['enabled ' ] ?? false ) === true ) {
30- // TODO: register simple normalizer related services
31- }
32-
33- if (($ config ['jwt_refresh ' ]['enabled ' ] ?? false ) === true ) {
34- // TODO: register JWT refresh related services
35- }
36-
37- if (($ config ['iri_template_generator ' ]['enabled ' ] ?? false ) === true ) {
38- // TODO: register iri templates generator related services
39- }
22+ $ this ->setParameters ($ container , $ config , $ this ->getAlias ());
4023 }
4124
4225 /**
@@ -46,4 +29,23 @@ public function getConfiguration(array $config, ContainerBuilder $container): Co
4629 {
4730 return new Configuration ($ this );
4831 }
32+
33+ /**
34+ * @param mixed[] $config
35+ */
36+ private function setParameters (
37+ ContainerBuilder $ container ,
38+ array $ config ,
39+ string $ alias ,
40+ ): void {
41+ foreach ($ config as $ key => $ value ) {
42+ $ paramName = "{$ alias }. {$ key }" ;
43+
44+ if (is_array ($ value )) {
45+ $ this ->setParameters ($ container , $ value , $ paramName );
46+ } else {
47+ $ container ->setParameter ($ paramName , $ value );
48+ }
49+ }
50+ }
4951}
0 commit comments