MediaWiki  1.30.0
Diff Class Reference

Class representing a 'diff' between two sequences of strings. More...

Inheritance diagram for Diff:
Collaboration diagram for Diff:

Public Member Functions

 __construct ( $from_lines, $to_lines)
 Computes diff between sequences of strings. More...
 
 closing ()
 Get the closing set of lines. More...
 
 getEdits ()
 
 isEmpty ()
 Check for empty diff. More...
 
 lcs ()
 Compute the length of the Longest Common Subsequence (LCS). More...
 
 orig ()
 Get the original set of lines. More...
 
 reverse ()
 Compute reversed Diff. More...
 

Public Attributes

DiffOp[] $edits
 

Protected Attributes

int $bailoutComplexity = 0
 If this diff complexity is exceeded, a ComplexityException is thrown 0 means no limit. More...
 

Detailed Description

Class representing a 'diff' between two sequences of strings.

Todo:
document
Access:\n private

Definition at line 200 of file DairikiDiff.php.

Constructor & Destructor Documentation

◆ __construct()

Diff::__construct (   $from_lines,
  $to_lines 
)

Computes diff between sequences of strings.

Parameters
string[]$from_linesAn array of strings. Typically these are lines from a file.
string[]$to_linesAn array of strings.
Exceptions

Reimplemented in WordLevelDiff.

Definition at line 221 of file DairikiDiff.php.

References edits, and DiffEngine\setBailoutComplexity().

Member Function Documentation

◆ closing()

Diff::closing ( )

Get the closing set of lines.

This reconstructs the $to_lines parameter passed to the constructor.

Returns
string[] The sequence of strings.

Reimplemented in WordLevelDiff.

Definition at line 317 of file DairikiDiff.php.

References $lines, as, captcha-old\count, and edits.

◆ getEdits()

Diff::getEdits ( )
Returns
DiffOp[]

Definition at line 230 of file DairikiDiff.php.

References $edits.

◆ isEmpty()

Diff::isEmpty ( )

Check for empty diff.

Returns
bool True if two sequences were identical.

Definition at line 261 of file DairikiDiff.php.

References as, and edits.

◆ lcs()

Diff::lcs ( )

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

This is mostly for diagnostic purposed.

Returns
int The length of the LCS.

Definition at line 278 of file DairikiDiff.php.

References as, captcha-old\count, and edits.

◆ orig()

Diff::orig ( )

Get the original set of lines.

This reconstructs the $from_lines parameter passed to the constructor.

Returns
string[] The original sequence of strings.

Reimplemented in WordLevelDiff.

Definition at line 297 of file DairikiDiff.php.

References $lines, as, captcha-old\count, and edits.

◆ reverse()

Diff::reverse ( )

Compute reversed Diff.

SYNOPSIS:

$diff = new Diff($lines1, $lines2); $rev = $diff->reverse();

Returns
Object A Diff object representing the inverse of the original diff.

Definition at line 245 of file DairikiDiff.php.

References $rev, as, and edits.

Member Data Documentation

◆ $bailoutComplexity

int Diff::$bailoutComplexity = 0
protected

If this diff complexity is exceeded, a ComplexityException is thrown 0 means no limit.

Definition at line 211 of file DairikiDiff.php.

◆ $edits

DiffOp [] Diff::$edits

Definition at line 205 of file DairikiDiff.php.

Referenced by getEdits().


The documentation for this class was generated from the following file: