public function HWLDFWordAccumulator::addWords

public HWLDFWordAccumulator::addWords($words, $tag = '')

File

core/lib/Drupal/Component/Diff/Engine/HWLDFWordAccumulator.php, line 56

Class

HWLDFWordAccumulator
@todo document @private @subpackage DifferenceEngine

Namespace

Drupal\Component\Diff\Engine

Code

public function addWords($words, $tag = '') {
  if ($tag != $this->tag) {
    $this->_flushGroup($tag);
  }
  foreach ($words as $word) {
    // new-line should only come as first char of word.
    if ($word == '') {
      continue;
    }
    if ($word[0] == "\n") {
      $this->_flushLine($tag);
      $word = Unicode::substr($word, 1);
    }
    assert(!strstr($word, "\n"));
    $this->group .= $word;
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Diff!Engine!HWLDFWordAccumulator.php/function/HWLDFWordAccumulator::addWords/8.1.x