You are here

function Diff::lcs in Diff 6

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

* Compute the length of the Longest Common Subsequence (LCS). * * This is mostly for diagnostic purposed. * *

Return value

int The length of the LCS.

1 call to Diff::lcs()
Diff::_check in ./DiffEngine.php
* Check a Diff for validity. * * This is here only for debugging purposes.

File

./DiffEngine.php, line 596

Class

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

Code

function lcs() {
  $lcs = 0;
  foreach ($this->edits as $edit) {
    if ($edit->type == 'copy') {
      $lcs += sizeof($edit->orig);
    }
  }
  return $lcs;
}