/** * @return string[] */ public function closing() { wfProfileIn(__METHOD__); $closing = new HWLDFWordAccumulator(); foreach ($this->edits as $edit) { if ($edit->type == 'copy') { $closing->addWords($edit->closing); } elseif ($edit->closing) { $closing->addWords($edit->closing, 'ins'); } } $lines = $closing->getLines(); wfProfileOut(__METHOD__); return $lines; }
/** * Builds the string of deleted and added words from the given diff. * @param WordLevelDiff $diff * @return array Array of changed lines */ private function inlineWordDiff($diff) { $inline = new HWLDFWordAccumulator(); $inline->insClass = $inline->delClass = ''; foreach ($diff->edits as $edit) { if ($edit->type == 'copy') { $inline->addWords($edit->orig); } elseif ($edit->type == 'delete') { $inline->addWords($edit->orig, 'del'); } elseif ($edit->type == 'add') { $inline->addWords($edit->closing, 'ins'); } else { $inline->addWords($edit->orig, 'del'); $inline->addWords($edit->closing, 'ins'); } } $lines = $inline->getLines(); return $lines; }