/** * @return bool */ private function handleProcess(Process $process) { if ($process->isStarted()) { if ($process->isTerminated()) { $this->running--; return true; } return false; } // Only start a new process if we haven't reached the limit yet. if ($this->running < $this->config->getProcessAsyncLimit()) { $process->start(); $this->running++; } return false; }