Refactor names in CommandResolverInterface

This commit is contained in:
2024-12-28 15:35:41 +01:00
parent 07f8ae467c
commit 9ab9561270
5 changed files with 68 additions and 10 deletions

View File

@ -51,6 +51,11 @@ class CommandBus implements CommandBusInterface
$this->resolvers[] = $resolver;
}
public function removeResolver(CommandResolverInterface $resolver): void
{
// FIXME implement
}
/**
* Get the names of defined commands
*
@ -60,7 +65,7 @@ class CommandBus implements CommandBusInterface
{
$commands = [];
foreach ($this->resolvers as $resolver) {
$commands = array_merge($commands, $resolver->getNames());
$commands = array_merge($commands, $resolver->getCommandNames());
}
sort($commands);
return array_unique($commands);
@ -75,7 +80,7 @@ class CommandBus implements CommandBusInterface
public function findCommand(string $command): ?Command
{
foreach ($this->resolvers as $resolver) {
if ($found = $resolver->find($command))
if ($found = $resolver->findCommand($command))
return $found;
}
return null;