function diffTest(&$session) { $x2 = "a\nx\ny\nz\nb"; $x1 = "a\nb"; $x2 = "x\ny\nb"; $x1 = "m\nb"; $x2 = "m"; $x1 = "x\ny"; guiParagraph($session, str_replace("\n", "<br>", $x1), false); guiParagraph($session, str_replace("\n", "<br>", $x2), false); $engine = new DiffEngine($session, $x1, $x2); $engine->compare(1, 1); }
/** * Constructor. * Computes diff between sequences of strings. * * @param string[] $from_lines An array of strings. * Typically these are lines from a file. * @param string[] $to_lines An array of strings. */ public function __construct($from_lines, $to_lines) { $eng = new DiffEngine(); $this->edits = $eng->diff($from_lines, $to_lines); }
/** * Constructor. * Computes diff between sequences of strings. * * @param string[] $from_lines An array of strings. * Typically these are lines from a file. * @param string[] $to_lines An array of strings. * @throws \MediaWiki\Diff\ComplexityException */ public function __construct($from_lines, $to_lines) { $eng = new DiffEngine(); $eng->setBailoutComplexity($this->bailoutComplexity); $this->edits = $eng->diff($from_lines, $to_lines); }