protected function getWorker($name)
{
if (!$this->hasWorker($name)) {
throw new UnexpectedValueException("Command '" . $name . "' does not have a worker");
}
$worker = $this->workers[$name];
if (is_string($worker)) {
$worker = new $worker($this->worker_data);
$this->workers[$name] = $worker;
}
if (!$worker instanceof WorkerInterface) {
throw new UnexpectedValueException("Worker '" . $name . "' is not a WorkerInterface");
}
return $worker;
}