<?php
namespace CodersLab\Lms\SharedKernel\Infrastructure\Bus;
use CodersLab\Lms\SharedKernel\Common\Assert;
use CodersLab\Lms\SharedKernel\Domain\Bus\CommandBus;
use Symfony\Component\Messenger\MessageBusInterface;
use Symfony\Component\Messenger\Stamp\StampInterface;
final class MessengerCommandBus implements CommandBus
{
public function __construct(private MessageBusInterface $commandBus)
{
}
public function dispatch(mixed $command, array $stamps = []): void
{
Assert::allIsInstanceOf($stamps, StampInterface::class);
$this->commandBus->dispatch($command, $stamps);
}
}