<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;
use PpPhp\Core\Platform\Event\EventBus;

final class EventsCommand extends AbstractCommand
{
    public function name(): string { return 'events'; }
    public function description(): string { return 'Show Event Bus overview.'; }

    public function handle(array $arguments = []): int
    {
        $bus = new EventBus();

        $this->title('PPphp Event Bus');
        $this->line('Status: OK');
        $this->line('Listeners: ' . $bus->repository()->count());
        $this->line('History: ' . count($bus->history()));

        return 0;
    }
}
