Returns the next job from the queue.
\Drupal\tmgmt\JobInterface|null A job or NULL if the queue is empty.
public function getNextJob() {
while ($id = reset($this->queue)) {
if ($job = Job::load($id)) {
return $job;
}
else {
// Stale job ID that can't be loaded, remove it from the queue.
array_shift($this->queue);
}
}
}