Mahdee Rajon
File "QueryBus.php"
Full Path: /var/www/html/back/app/Buses/QueryBus.php
File size: 542 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
declare(strict_types=1);
namespace App\Buses;
use App\Contracts\QueryBusContract;
use Illuminate\Bus\Dispatcher;
final class QueryBus implements QueryBusContract
{
private readonly Dispatcher $queryBus;
public function __construct(Dispatcher $queryBus)
{
$this->queryBus = $queryBus;
}
public function ask(object $query): mixed
{
return $this->queryBus->dispatch(command: $query);
}
public function register(array $map): void
{
$this->queryBus->map(map: $map);
}
}