[ Index ]

PHP Cross Reference of MyBB

title

Body

[close]

/inc/3rdparty/diff/ -> Diff.php (summary)

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

Author: Geoffrey T. Dairiki <dairiki@dairiki.org>
File Size: 261 lines (8 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Horde_Text_Diff:: (11 methods):
  __construct()
  getDiff()
  countAddedLines()
  countDeletedLines()
  reverse()
  isEmpty()
  lcs()
  getOriginal()
  getFinal()
  trimNewlines()
  _check()


Class: Horde_Text_Diff  - X-Ref

__construct($engine, $params)   X-Ref
Computes diffs between sequences of strings.

param: string $engine     Name of the diffing engine to use.  'auto'
param: array $params      Parameters to pass to the diffing engine.

getDiff()   X-Ref
Returns the array of differences.


countAddedLines()   X-Ref
returns the number of new (added) lines in a given diff.

return: integer The number of new lines

countDeletedLines()   X-Ref
Returns the number of deleted (removed) lines in a given diff.

return: integer The number of deleted lines

reverse()   X-Ref
Computes a reversed diff.

Example:
<code>
$diff = new Horde_Text_Diff($lines1, $lines2);
$rev = $diff->reverse();
</code>

return: Horde_Text_Diff  A Diff object representing the inverse of the

isEmpty()   X-Ref
Checks for an empty diff.

return: boolean  True if two sequences were identical.

lcs()   X-Ref
Computes the length of the Longest Common Subsequence (LCS).

This is mostly for diagnostic purposes.

return: integer  The length of the LCS.

getOriginal()   X-Ref
Gets the original set of lines.

This reconstructs the $from_lines parameter passed to the constructor.

return: array  The original sequence of strings.

getFinal()   X-Ref
Gets the final set of lines.

This reconstructs the $to_lines parameter passed to the constructor.

return: array  The sequence of strings.

trimNewlines(&$line, $key)   X-Ref
Removes trailing newlines from a line of text. This is meant to be used
with array_walk().

param: string $line  The line to trim.
param: integer $key  The index of the line in the array. Not used.

_check($from_lines, $to_lines)   X-Ref
Checks a diff for validity.

This is here only for debugging purposes.



Generated: Tue Oct 8 19:19:50 2013 Cross-referenced by PHPXref 0.7.1