/**
  * Frees a worker and removes workers that are not running
  * from the internal collection of running workers.
  *
  * @param WorkerInterface $worker
  *
  * @return void
  */
 public function onWorkerComplete(WorkerInterface $worker)
 {
     $worker->free();
     $this->running = array_filter($this->running, function (WorkerInterface $worker) {
         return $worker->isRunning();
     });
 }
 /**
  * Handle errors.
  *
  * @param $data
  * @return void
  */
 public function onError($error, WorkerInterface $worker)
 {
     $info = $worker->getJobInfo();
     $this->errors[$info->file] = $error;
     $failures = $this->result->getFailureCount();
     $this->result->setFailureCount(++$failures);
 }