You are here

protected function QueueWorker::removeDuplicates in Simple XML sitemap 4.x

Same name and namespace in other branches
  1. 8.3 src/Queue/QueueWorker.php \Drupal\simple_sitemap\Queue\QueueWorker::removeDuplicates()

Parameters

array $results:

1 call to QueueWorker::removeDuplicates()
QueueWorker::generateResultsFromElement in src/Queue/QueueWorker.php

File

src/Queue/QueueWorker.php, line 291

Class

QueueWorker

Namespace

Drupal\simple_sitemap\Queue

Code

protected function removeDuplicates(array &$results) : void {
  if ($this->generatorSettings['remove_duplicates'] && !empty($results)) {
    $result = $results[key($results)];
    if (isset($result['meta']['path'])) {
      if (isset($this->processedPaths[$result['meta']['path']])) {
        $results = [];
      }
      else {
        $this->processedPaths[$result['meta']['path']] = TRUE;
      }
    }
  }
}