You are here

public function WordLevelDiff::closing in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Diff/WordLevelDiff.php \Drupal\Component\Diff\WordLevelDiff::closing()
  2. 9 core/lib/Drupal/Component/Diff/WordLevelDiff.php \Drupal\Component\Diff\WordLevelDiff::closing()

File

core/lib/Drupal/Component/Diff/WordLevelDiff.php, line 66

Class

WordLevelDiff
@todo document @private @subpackage DifferenceEngine

Namespace

Drupal\Component\Diff

Code

public function closing() {
  $closing = new HWLDFWordAccumulator();
  foreach ($this->edits as $edit) {
    if ($edit->type == 'copy') {
      $closing
        ->addWords($edit->closing);
    }
    elseif ($edit->closing) {
      $closing
        ->addWords($edit->closing, 'mark');
    }
  }
  $lines = $closing
    ->getLines();
  return $lines;
}