<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;
use PpPhp\Core\Platform\Event\Scheduler\EventScheduler;

final class SchedulerStatsCommand extends AbstractCommand
{
    public function name(): string { return 'scheduler:stats'; }
    public function description(): string { return 'Show Scheduler statistics.'; }

    public function handle(array $arguments = []): int
    {
        $stats = (new EventScheduler())->statistics()->toArray();
        $this->title('PPphp Scheduler Stats');
        foreach ($stats as $key => $value) {
            $this->line($key . ': ' . $value);
        }
        return 0;
    }
}
