function HWLDFWordAccumulator::addWords

Same name in other branches
  1. 9 core/lib/Drupal/Component/Diff/Engine/HWLDFWordAccumulator.php \Drupal\Component\Diff\Engine\HWLDFWordAccumulator::addWords()
  2. 10 core/lib/Drupal/Component/Diff/Engine/HWLDFWordAccumulator.php \Drupal\Component\Diff\Engine\HWLDFWordAccumulator::addWords()
  3. 11.x core/lib/Drupal/Component/Diff/Engine/HWLDFWordAccumulator.php \Drupal\Component\Diff\Engine\HWLDFWordAccumulator::addWords()

File

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

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 = mb_substr($word, 1);
        }
        assert(!strstr($word, "\n"));
        $this->group .= $word;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.