You are here

function Diff::reverse in Diff 7.2

Same name and namespace in other branches
  1. 5.2 DiffEngine.php \Diff::reverse()
  2. 5 DiffEngine.php \Diff::reverse()
  3. 6.2 DiffEngine.php \Diff::reverse()
  4. 6 DiffEngine.php \Diff::reverse()
  5. 7.3 DiffEngine.php \Diff::reverse()

Compute reversed Diff.

SYNOPSIS:

$diff = new Diff($lines1, $lines2); $rev = $diff->reverse();

Return value

object A Diff object representing the inverse of the original diff.

1 call to Diff::reverse()
Diff::_check in ./DiffEngine.php
Check a Diff for validity.

File

./DiffEngine.php, line 596
A PHP diff engine for phpwiki. (Taken from phpwiki-1.3.3)

Class

Diff
Class representing a 'diff' between two sequences of strings. @todo document @private @subpackage DifferenceEngine

Code

function reverse() {
  $rev = $this;
  $rev->edits = array();
  foreach ($this->edits as $edit) {
    $rev->edits[] = $edit
      ->reverse();
  }
  return $rev;
}