diff --git a/composer.lock b/composer.lock index b1ce428..9b97a2e 100644 --- a/composer.lock +++ b/composer.lock @@ -12,12 +12,12 @@ "source": { "type": "git", "url": "https://github.com/Phauthentic/correlation-id.git", - "reference": "a7ee97ae0c166407df5e0ca3ca8326c3702ae7f4" + "reference": "9e0e298bd34665e05ff5ac9505379d67e6d45ef9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Phauthentic/correlation-id/zipball/a7ee97ae0c166407df5e0ca3ca8326c3702ae7f4", - "reference": "a7ee97ae0c166407df5e0ca3ca8326c3702ae7f4", + "url": "https://api.github.com/repos/Phauthentic/correlation-id/zipball/9e0e298bd34665e05ff5ac9505379d67e6d45ef9", + "reference": "9e0e298bd34665e05ff5ac9505379d67e6d45ef9", "shasum": "" }, "require": { @@ -54,7 +54,7 @@ "issues": "https://github.com/Phauthentic/correlation-id/issues", "source": "https://github.com/Phauthentic/correlation-id/tree/2.0.0" }, - "time": "2024-03-27T23:29:11+00:00" + "time": "2024-03-27T23:51:34+00:00" }, { "name": "psr/event-dispatcher", @@ -1380,16 +1380,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.65", + "version": "1.10.66", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "3c657d057a0b7ecae19cb12db446bbc99d8839c6" + "reference": "94779c987e4ebd620025d9e5fdd23323903950bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3c657d057a0b7ecae19cb12db446bbc99d8839c6", - "reference": "3c657d057a0b7ecae19cb12db446bbc99d8839c6", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/94779c987e4ebd620025d9e5fdd23323903950bd", + "reference": "94779c987e4ebd620025d9e5fdd23323903950bd", "shasum": "" }, "require": { @@ -1438,7 +1438,7 @@ "type": "tidelift" } ], - "time": "2024-03-23T10:30:26+00:00" + "time": "2024-03-28T16:17:31+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1763,16 +1763,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.15", + "version": "10.5.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "86376e05e8745ed81d88232ff92fee868247b07b" + "reference": "18f8d4a5f52b61fdd9370aaae3167daa0eeb69cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/86376e05e8745ed81d88232ff92fee868247b07b", - "reference": "86376e05e8745ed81d88232ff92fee868247b07b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/18f8d4a5f52b61fdd9370aaae3167daa0eeb69cd", + "reference": "18f8d4a5f52b61fdd9370aaae3167daa0eeb69cd", "shasum": "" }, "require": { @@ -1844,7 +1844,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.15" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.16" }, "funding": [ { @@ -1860,7 +1860,7 @@ "type": "tidelift" } ], - "time": "2024-03-22T04:17:47+00:00" + "time": "2024-03-28T10:08:10+00:00" }, { "name": "psr/container", diff --git a/config/services.yaml b/config/services.yaml index e8a399f..a04773a 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -1,6 +1,9 @@ services: Phauthentic\CorrelationIdBundle\EventSubscriber\CorrelationIdSubscriber: arguments: - $config: '%correlation_id%' + $config: + response_header_name: '%correlation_id.response_header_name%' + request_header_name: '%correlation_id.request_header_name%' + pass_through: '%correlation_id.pass_through%' tags: - { name: 'kernel.event_subscriber' } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 16739ac..95fce90 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,22 +1,22 @@ - - - - - - - - - - - tests - - - - - src - - + + + + + + + + + + + tests + + + + + src + + diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index bae0f09..5045b70 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -13,9 +13,10 @@ public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('correlation_id'); + /* @phpstan-ignore-next-line */ $treeBuilder->getRootNode() - ->children() - ->booleanNode('passthrough') + ->children() + ->booleanNode('pass_through') ->defaultValue(false) ->end() ->scalarNode('response_header_name') diff --git a/src/DependencyInjection/CorrelationIdExtension.php b/src/DependencyInjection/CorrelationIdExtension.php index 877f124..0b40421 100644 --- a/src/DependencyInjection/CorrelationIdExtension.php +++ b/src/DependencyInjection/CorrelationIdExtension.php @@ -18,18 +18,18 @@ class CorrelationIdExtension extends Extension { public function load(array $configs, ContainerBuilder $container): void { + $configuration = new Configuration(); + $config = $this->processConfiguration($configuration, $configs); + + $container->setParameter('correlation_id.request_header_name', $config['response_header_name']); + $container->setParameter('correlation_id.response_header_name', $config['response_header_name']); + $container->setParameter('correlation_id.pass_through', $config['pass_through']); + $yamlLoader = new Loader\YamlFileLoader( $container, new FileLocator(__DIR__ . '/../../config') ); $yamlLoader->load('services.yaml'); - - $configuration = new Configuration(); - - $config = $this->processConfiguration($configuration, $configs); - - $container->setParameter('correlation_id.request_header_name', $config['response_header_name']); - $container->setParameter('correlation_id.response_header_name', $config['response_header_name']); } } diff --git a/src/EventSubscriber/CorrelationIdSubscriber.php b/src/EventSubscriber/CorrelationIdSubscriber.php index e243f51..1e33fa7 100644 --- a/src/EventSubscriber/CorrelationIdSubscriber.php +++ b/src/EventSubscriber/CorrelationIdSubscriber.php @@ -32,8 +32,8 @@ public function __construct(array $config = []) $this->responseHeaderName = (string)$config['response_header_name']; } - if (isset($config['response_header_name'])) { - $this->passthrough = (bool)$config['passthrough']; + if (isset($config['pass_through'])) { + $this->passthrough = (bool)$config['pass_through']; } }