class MappedDiff extends Diff

Computes diff between sequences of strings.

Properties

static $html_cleaner_class from Diff
$edits from Diff

Methods

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

Get the original set of lines.

from Diff
array
finaltext()

Get the final set of lines.

from Diff
_check($from_lines, $to_lines)

Check a Diff for validity.

from Diff
static 
cleanHTML(string $content, object $cleaner = null)

Attempt to clean invalid HTML, which messes up diffs.

from Diff
static String
compareHTML(String $from, String $to, Boolean $escape = false)

No description

from Diff
static 
getHTMLChunks(string|array $content)

No description

from Diff

Details

at line 854
__construct($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines)

Constructor.

Computes diff between sequences of strings.

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

Parameters

$from_lines array An array of strings. (Typically these are lines from a file.)
$to_lines array An array of strings.
$mapped_from_lines array 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.
$mapped_to_lines array This array should have the same number of elements as $to_lines.

in Diff at line 557
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.

in Diff at line 571
bool isEmpty()

Check for empty diff.

Return Value

bool True iff two sequences were identical.

in Diff at line 586
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.

in Diff at line 603
array orig()

Get the original set of lines.

This reconstructs the $from_lines parameter passed to the constructor.

Return Value

array The original sequence of strings.

in Diff at line 621
array finaltext()

Get the final set of lines.

This reconstructs the $to_lines parameter passed to the constructor.

Return Value

array The sequence of strings.

in Diff at line 636
_check($from_lines, $to_lines)

Check a Diff for validity.

This is here only for debugging purposes.

Parameters

$from_lines
$to_lines

in Diff at line 673
static cleanHTML(string $content, object $cleaner = null)

Attempt to clean invalid HTML, which messes up diffs.

This cleans code if possible, using an instance of HTMLCleaner

NB: By default, only extremely simple tidying is performed, by passing through DomDocument::loadHTML and saveXML

Parameters

string $content HTML content
object $cleaner Optional instance of a HTMLCleaner class to use, overriding self::$html_cleaner_class

in Diff at line 702
static String compareHTML(String $from, String $to, Boolean $escape = false)

Parameters

String $from
String $to
Boolean $escape

Return Value

String

in Diff at line 794
static getHTMLChunks(string|array $content)

Parameters

string|array $content If passed as an array, values will be concatenated with a comma.