class MappedDiff extends Diff (View source)

FIXME: bad name.

document

Properties

protected DiffOp[] $edits

The list of differences as an array of diff operations.

from  Diff

Methods

__construct(array $from_lines, array $to_lines, array $mapped_from_lines, array $mapped_to_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.

from  Diff
array
closing()

Gets the closing set of lines.

from  Diff
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

Details

__construct(array $from_lines, array $to_lines, array $mapped_from_lines, array $mapped_to_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

array $from_lines

An array of strings. (Typically these are lines from a file.)

array $to_lines

An array of strings.

array $mapped_from_lines

This array should have the same size number of elements as $from_lines. The elements in $mapped_from_lines and $mapped_to_lines are what is actually compared when computing the diff.

array $mapped_to_lines

This array should have the same number of elements as $to_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.