11<?php
2+ /**
3+ * @copyright 2014-present Hostnet B.V.
4+ */
5+ declare (strict_types=1 );
6+
27namespace Hostnet \Bundle \EntityTrackerBundle \DependencyInjection ;
38
49use Symfony \Component \Config \FileLocator ;
712use Symfony \Component \DependencyInjection \Reference ;
813use Symfony \Component \HttpKernel \DependencyInjection \Extension ;
914
10- /**
11- * This is the class that loads and manages your bundle configuration
12- *
13- * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
14- *
15- * @author Iltar van der Berg <ivanderberg@hostnet.nl>
16- */
1715class HostnetEntityTrackerExtension extends Extension
1816{
19- const BLAMABLE = 'Hostnet\Component\EntityBlamable\Blamable ' ;
20- const MUTATION = 'Hostnet\Component\EntityMutation\Mutation ' ;
21- const REVISION = 'Hostnet\Component\EntityRevision\Revision ' ;
17+ private const BLAMABLE = 'Hostnet\Component\EntityBlamable\Blamable ' ;
18+ private const MUTATION = 'Hostnet\Component\EntityMutation\Mutation ' ;
19+ private const REVISION = 'Hostnet\Component\EntityRevision\Revision ' ;
2220
23- /**
24- * @see \Symfony\Component\DependencyInjection\Extension\ExtensionInterface::load()
25- */
26- public function load (array $ configs , ContainerBuilder $ container )
21+ public function load (array $ configs , ContainerBuilder $ container ): void
2722 {
2823 $ loader = new YamlFileLoader ($ container , new FileLocator (__DIR__ . '/../Resources/config ' ));
2924 $ configuration = new Configuration ();
3025 $ config = $ this ->processConfiguration ($ configuration , $ configs );
3126
32- $ loader ->load ('services.yml ' );
27+ $ loader ->load ('services.yaml ' );
3328
34- if (array_key_exists ('blamable ' , $ config )) {
29+ if (\ array_key_exists ('blamable ' , $ config )) {
3530 $ this ->validateComponent (self ::BLAMABLE , 'blamable ' );
36- $ loader ->load ('blamable.yml ' );
37- if (
38- $ container ->hasParameter ('kernel.bundles ' )
39- && array_key_exists ('SecurityBundle ' , $ container ->getParameter ('kernel.bundles ' ))
31+ $ loader ->load ('blamable.yaml ' );
32+ if ($ container ->hasParameter ('kernel.bundles ' )
33+ && \array_key_exists ('SecurityBundle ' , $ container ->getParameter ('kernel.bundles ' ))
4034 ) {
41- $ loader ->load ('security.yml ' );
35+ $ loader ->load ('security.yaml ' );
4236 }
37+
4338 $ container
4439 ->getDefinition ('entity_tracker.listener.blamable ' )
4540 ->replaceArgument (1 , new Reference ($ config ['blamable ' ]['provider ' ]));
41+
4642 if (isset ($ config ['blamable ' ]['default_username ' ])) {
4743 $ container
4844 ->getDefinition (Configuration::BLAMABLE_DEFAULT_PROVIDER )
@@ -52,19 +48,19 @@ public function load(array $configs, ContainerBuilder $container)
5248 $ this ->validateClass (self ::BLAMABLE , 'blamable ' );
5349 }
5450
55- if (array_key_exists ('revision ' , $ config )) {
51+ if (\ array_key_exists ('revision ' , $ config )) {
5652 $ this ->validateComponent (self ::REVISION , 'revision ' );
57- $ loader ->load ('revision.yml ' );
53+ $ loader ->load ('revision.yaml ' );
5854 $ container
5955 ->getDefinition ('entity_tracker.listener.revision ' )
6056 ->replaceArgument (1 , new Reference ($ config ['revision ' ]['factory ' ]));
6157 } else {
6258 $ this ->validateClass (self ::REVISION , 'revision ' );
6359 }
6460
65- if (array_key_exists ('mutation ' , $ config )) {
61+ if (\ array_key_exists ('mutation ' , $ config )) {
6662 $ this ->validateComponent (self ::MUTATION , 'mutation ' );
67- $ loader ->load ('mutation.yml ' );
63+ $ loader ->load ('mutation.yaml ' );
6864 } else {
6965 $ this ->validateClass (self ::MUTATION , 'mutation ' );
7066 }
@@ -73,9 +69,10 @@ public function load(array $configs, ContainerBuilder $container)
7369 /**
7470 * @param string $annotation_class
7571 * @param string $config_name
72+ *
7673 * @throws \RuntimeException
7774 */
78- protected function validateComponent ($ annotation_class , $ config_name )
75+ protected function validateComponent (string $ annotation_class , string $ config_name ): void
7976 {
8077 if (class_exists ($ annotation_class )) {
8178 return ;
@@ -91,9 +88,10 @@ protected function validateComponent($annotation_class, $config_name)
9188 /**
9289 * @param string $annotation_class
9390 * @param string $config_name
91+ *
9492 * @throws \RuntimeException
9593 */
96- protected function validateClass ($ annotation_class , $ config_name )
94+ protected function validateClass (string $ annotation_class , string $ config_name ): void
9795 {
9896 if (!class_exists ($ annotation_class )) {
9997 return ;
0 commit comments