<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class WorkerStartCommand extends AbstractCommand
{
    public function name(): string { return 'worker:start'; }
    public function description(): string { return 'PPphp Event Worker Start'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Event Worker Start');
        $manager = \PpPhp\Core\Platform\Event\Worker\Runtime\WorkerRuntimeManager::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); $manager->ensureDefaultWorker('worker_start'); $manager->runtime()->startAll(); $manager->save(); $this->line('Started: ' . $manager->runtime()->workers()->count());
        return 0;
    }
}
