Mahdee Rajon  subception

File "CommandBus.php"

Full Path: /var/www/html/back/app/Buses/CommandBus.php
File size: 569 bytes
MIME-type: text/x-php
Charset: utf-8

<?php

declare(strict_types=1);

namespace App\Buses;

use App\Contracts\CommandBusContract;
use Illuminate\Bus\Dispatcher;

final class CommandBus implements CommandBusContract
{
    private readonly Dispatcher $commandBus;

    public function __construct(Dispatcher $commandBus)
    {
        $this->commandBus = $commandBus;
    }

    public function dispatch(object $command): mixed
    {
        return $this->commandBus->dispatch(command: $command);
    }

    public function register(array $map): void
    {
        $this->commandBus->map(map: $map);
    }
}