class WordLevelDiff extends MappedDiff (View source)

document

Constants

MAX_LINE_LENGTH

Properties

protected DiffOp[] $edits

The list of differences as an array of diff operations.

from  Diff

Methods

__construct($orig_lines, $closing_lines)

Constructor.

object
reverse()

Compute reversed Diff.

from  Diff
bool
isEmpty()

Check for empty diff.

from  Diff
int
lcs()

Compute the length of the Longest Common Subsequence (LCS).

from  Diff
array
orig()

Gets the original set of lines.

array
closing()

Gets the closing set of lines.

check($from_lines, $to_lines)

Check a Diff for validity.

from  Diff
DiffOp[]
getEdits()

Gets the list of differences as an array of diff operations.

from  Diff
_split($lines)

No description

Details

__construct($orig_lines, $closing_lines)

Constructor.

Computes diff between sequences of strings.

This can be used to compute things like case-insensitive diffs, or diffs which ignore changes in white-space.

Parameters

$orig_lines
$closing_lines

object 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.

bool isEmpty()

Check for empty diff.

Return Value

bool

True iff two sequences were identical.

int lcs()

Compute the length of the Longest Common Subsequence (LCS).

This is mostly for diagnostic purposed.

Return Value

int

The length of the LCS.

array orig()

Gets the original set of lines.

This reconstructs the $from_lines parameter passed to the constructor.

Return Value

array

The original sequence of strings.

array closing()

Gets the closing set of lines.

This reconstructs the $to_lines parameter passed to the constructor.

Return Value

array

The sequence of strings.

check($from_lines, $to_lines)

Check a Diff for validity.

This is here only for debugging purposes.

Parameters

$from_lines
$to_lines

DiffOp[] getEdits()

Gets the list of differences as an array of diff operations.

Return Value

DiffOp[]

The list of differences as an array of diff operations.

protected _split($lines)

No description

Parameters

$lines