src/Lms/SharedKernel/Infrastructure/Bus/MessengerCommandBus.php line 19

Open in your IDE?
  1. <?php
  2. namespace CodersLab\Lms\SharedKernel\Infrastructure\Bus;
  3. use CodersLab\Lms\SharedKernel\Common\Assert;
  4. use CodersLab\Lms\SharedKernel\Domain\Bus\CommandBus;
  5. use Symfony\Component\Messenger\MessageBusInterface;
  6. use Symfony\Component\Messenger\Stamp\StampInterface;
  7. final class MessengerCommandBus implements CommandBus
  8. {
  9.     public function __construct(private MessageBusInterface $commandBus)
  10.     {
  11.     }
  12.     public function dispatch(mixed $command, array $stamps = []): void
  13.     {
  14.         Assert::allIsInstanceOf($stampsStampInterface::class);
  15.         $this->commandBus->dispatch($command$stamps);
  16.     }
  17. }