Skip to content

Commit

Permalink
refactor: Remove condition
Browse files Browse the repository at this point in the history
  • Loading branch information
tienvx committed Apr 1, 2024
1 parent 55955d2 commit 24984fe
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions src/DependencyInjection/TienvxPactProviderExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,21 @@ public function load(array $configs, ContainerBuilder $container): void
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.php');

if (method_exists($container, 'registerAttributeForAutoconfiguration')) {
$container->registerAttributeForAutoconfiguration(
AsStateHandler::class,
static function (ChildDefinition $definition, AsStateHandler $attribute, \Reflector $reflector): void {
$tagAttributes = get_object_vars($attribute);
$definition->addTag('pact_provider.state_handler', $tagAttributes);
}
);

$container->registerAttributeForAutoconfiguration(
AsMessageDispatcher::class,
static function (ChildDefinition $definition, AsMessageDispatcher $attribute, \Reflector $reflector): void {
$tagAttributes = get_object_vars($attribute);
$definition->addTag('pact_provider.message_dispatcher', $tagAttributes);
}
);
}
$container->registerAttributeForAutoconfiguration(
AsStateHandler::class,
static function (ChildDefinition $definition, AsStateHandler $attribute, \Reflector $reflector): void {
$tagAttributes = get_object_vars($attribute);
$definition->addTag('pact_provider.state_handler', $tagAttributes);
}
);

$container->registerAttributeForAutoconfiguration(
AsMessageDispatcher::class,
static function (ChildDefinition $definition, AsMessageDispatcher $attribute, \Reflector $reflector): void {
$tagAttributes = get_object_vars($attribute);
$definition->addTag('pact_provider.message_dispatcher', $tagAttributes);
}
);

$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
Expand Down

0 comments on commit 24984fe

Please sign in to comment.