function 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 drupal/core/lib/Drupal/Component/Diff/DiffEngine.php
Check a Diff for validity.

File

drupal/core/lib/Drupal/Component/Diff/DiffEngine.php, line 625
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 lcs() {
  $lcs = 0;
  foreach ($this->edits as $edit) {
    if ($edit->type == 'copy') {
      $lcs += sizeof($edit->orig);
    }
  }
  return $lcs;
}