56 $this->edits = $eng->diff( $from_lines, $to_lines );
81 foreach ( $this->edits as $edit ) {
82 $rev->edits[] = $edit->reverse();
94 foreach ( $this->edits as $edit ) {
95 if ( $edit->type !=
'copy' ) {
112 foreach ( $this->edits as $edit ) {
113 if ( $edit->type ==
'copy' ) {
114 $lcs += count( $edit->orig );
132 foreach ( $this->edits as $edit ) {
134 array_splice(
$lines, count(
$lines ), 0, $edit->orig );
152 foreach ( $this->edits as $edit ) {
153 if ( $edit->closing ) {
154 array_splice(
$lines, count(
$lines ), 0, $edit->closing );
This diff implementation is mainly lifted from the LCS algorithm of the Eclipse project which in turn...
setBailoutComplexity( $value)
Sets the complexity (in comparison operations) that can't be exceeded.
The base class for all other DiffOp classes.
Class representing a 'diff' between two sequences of strings.
int $bailoutComplexity
If this diff complexity is exceeded, a ComplexityException is thrown 0 means no limit.
reverse()
Compute reversed Diff.
orig()
Get the original set of lines.
isEmpty()
Check for empty diff.
lcs()
Compute the length of the Longest Common Subsequence (LCS).
closing()
Get the closing set of lines.
__construct( $from_lines, $to_lines)
Computes diff between sequences of strings.