Text_Diff
[ class tree: Text_Diff ] [ index: Text_Diff ] [ all elements ]

Class: Text_Diff

Source Location: /Text_Diff-0.1.0/Diff.php

Class Overview


Text_Diff


Author(s):

Methods


Child classes:

Text_Diff3
A class for computing three way diffs.
Text_MappedDiff
$Horde: framework/Text_Diff/Diff.php,v 1.13 2005/05/26 20:26:06 selsky Exp $

Inherited Variables

Inherited Methods


Class Details

[line 16]
Text_Diff

General API for generating and formatting diffs - the differences between two sequences of strings.

The PHP diff code used in this package was originally written by Geoffrey T. Dairiki and is used with his permission.

$Horde: framework/Text_Diff/Diff.php,v 1.13 2005/05/26 20:26:06 selsky Exp $



[ Top ]


Method Detail

Text_Diff (Constructor)   [line 32]

Text_Diff Text_Diff( array $from_lines, array $to_lines)

Computes diffs between sequences of strings.

Parameters:

array   $from_lines   —  An array of strings. Typically these are lines from a file.
array   $to_lines   —  An array of strings.

[ Top ]

getDiff   [line 49]

void getDiff( )

Returns the array of differences.

[ Top ]

getFinal   [line 140]

array getFinal( )

Gets the final set of lines.

This reconstructs the $to_lines parameter passed to the constructor.

  • Return: The sequence of strings.

[ Top ]

getOriginal   [line 122]

array getOriginal( )

Gets the original set of lines.

This reconstructs the $from_lines parameter passed to the constructor.

  • Return: The original sequence of strings.

[ Top ]

isEmpty   [line 87]

boolean isEmpty( )

Checks for an empty diff.
  • Return: True if two sequences were identical.

[ Top ]

lcs   [line 104]

integer lcs( )

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

This is mostly for diagnostic purposes.

  • Return: The length of the LCS.

[ Top ]

reverse   [line 68]

Text_Diff reverse( )

Computes a reversed diff.

Example:

  1.  $diff &new Text_Diff($lines1$lines2);
  2.  $rev $diff->reverse();

  • Return: A Diff object representing the inverse of the original diff. Note that we purposely don't return a reference here, since this essentially is a clone() method.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:16:38 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.