<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class WorkerStaleListCommand extends AbstractCommand
{
    public function name(): string { return 'worker:stale:list'; }
    public function description(): string { return 'PPphp Worker Stale List'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Worker Stale List');
        $manager = \PpPhp\Core\Platform\Event\Worker\Monitoring\WorkerStaleManager::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); $summary = $manager->summary(); foreach ($summary['records'] as $record) { $this->line('- ' . $record['workerId'] . ' ' . $record['classification'] . ' stale=' . ($record['stale'] ? 'YES' : 'NO') . ' reason=' . $record['reason']); }
        return 0;
    }
}
