Property | Type | Description | |
---|---|---|---|
$_edits | array | Array of changes. |
Method | Description | |
---|---|---|
__construct ( string $engine, array $params ) | Computes diffs between sequences of strings. | |
countAddedLines ( ) : integer | returns the number of new (added) lines in a given diff. | |
countDeletedLines ( ) : integer | Returns the number of deleted (removed) lines in a given diff. | |
getDiff ( ) | Returns the array of differences. | |
getFinal ( ) : array | Gets the final set of lines. | |
getOriginal ( ) : array | Gets the original set of lines. | |
isEmpty ( ) : boolean | Checks for an empty diff. | |
lcs ( ) : integer | Computes the length of the Longest Common Subsequence (LCS). | |
reverse ( ) : Horde_Text_Diff | Computes a reversed diff. | |
trimNewlines ( string &$line, integer $key ) | Removes trailing newlines from a line of text. This is meant to be used with array_walk(). |
Method | Description | |
---|---|---|
_check ( $from_lines, $to_lines ) | Checks a diff for validity. |
public __construct ( string $engine, array $params ) | ||
$engine | string | Name of the diffing engine to use. 'auto' will automatically select the best. |
$params | array | Parameters to pass to the diffing engine. Normally an array of two arrays, each containing the lines from a file. |
protected _check ( $from_lines, $to_lines ) |
public countAddedLines ( ) : integer | ||
return | integer | The number of new lines |
public countDeletedLines ( ) : integer | ||
return | integer | The number of deleted lines |
public getOriginal ( ) : array | ||
return | array | The original sequence of strings. |
$diff = new Horde_Text_Diff($lines1, $lines2);
$rev = $diff->reverse();
public reverse ( ) : Horde_Text_Diff | ||
return | Horde_Text_Diff | 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. |
public static trimNewlines ( string &$line, integer $key ) | ||
$line | string | The line to trim. |
$key | integer | The index of the line in the array. Not used. |