Bravo3\Orm\Drivers\Common\WorkerPool::getWorker PHP Method

getWorker() protected method

Get a worker, lazy-loading as required
protected getWorker ( $name ) : Bravo3\Orm\Drivers\Common\WorkerInterface
$name
return Bravo3\Orm\Drivers\Common\WorkerInterface
    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;
    }