65c1b5fb75
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KTXC\Console\Event;
|
|
|
|
use KTXF\Event\EventListenerRegistry;
|
|
use Symfony\Component\Console\Attribute\AsCommand;
|
|
use Symfony\Component\Console\Command\Command;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
|
|
|
#[AsCommand(
|
|
name: 'events:debug',
|
|
description: 'Display the frozen event listener registry',
|
|
)]
|
|
final class EventsDebugCommand extends Command
|
|
{
|
|
public function __construct(
|
|
private readonly EventListenerRegistry $registry,
|
|
) {
|
|
parent::__construct();
|
|
}
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
|
{
|
|
$io = new SymfonyStyle($input, $output);
|
|
$rows = [];
|
|
foreach ($this->registry->definitions() as $listener) {
|
|
$rows[] = [
|
|
$listener->module,
|
|
$listener->event,
|
|
$listener->service . '::' . $listener->method,
|
|
$listener->delivery->value,
|
|
$listener->priority,
|
|
$listener->failurePolicy->value,
|
|
];
|
|
}
|
|
|
|
$io->table(
|
|
['Module', 'Event', 'Listener', 'Delivery', 'Priority', 'Failure'],
|
|
$rows,
|
|
);
|
|
|
|
return Command::SUCCESS;
|
|
}
|
|
}
|