You are here

public function LinkExtractorBatch::batchProcessEntities in Link checker 8

Process part of entities within a batch operation.

Parameters

int $numberOfItems: Number of items to process.

mixed $context: Context data from batch API.

File

src/LinkExtractorBatch.php, line 203

Class

LinkExtractorBatch
Helper service to handle extraction index.

Namespace

Drupal\linkchecker

Code

public function batchProcessEntities($numberOfItems, &$context) {
  if (!isset($context['sandbox']['total'])) {
    $context['sandbox']['total'] = $this
      ->getTotalEntitiesToProcess();
    $context['sandbox']['current'] = $this
      ->getNumberOfProcessedEntities();
  }
  $context['sandbox']['current'] += $this
    ->processEntities($numberOfItems);
  if (!empty($context['sandbox']['total'])) {
    $context['finished'] = $context['sandbox']['current'] / $context['sandbox']['total'];
  }
  else {
    $context['finished'] = 1;
  }
}