Class Diff
Class representing a 'diff' between two sequences of strings.
Methods summary
public
|
#
Diff( mixed $from_lines, mixed $to_lines )
Constructor. Computes diff between sequences of strings.
Constructor. Computes diff between sequences of strings.
Parameters
- $from_lines
- $from_lines array An array of strings. (Typically these are lines from a file.)
- $to_lines
- $to_lines array An array of strings.
|
public
object
|
#
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.
|
public
boolean
|
#
isEmpty( )
Check for empty diff.
Returns
boolean True iff two sequences were identical.
|
public
integer
|
#
lcs( )
Compute the length of the Longest Common Subsequence (LCS).
Compute the length of the Longest Common Subsequence (LCS).
This is mostly for diagnostic purposed.
Returns
integer The length of the LCS.
|
public
array
|
#
orig( )
Get the original set of lines.
Get the original set of lines.
This reconstructs the $from_lines parameter passed to the constructor.
Returns
array The original sequence of strings.
|
public
array
|
#
finaltext( )
Get the final set of lines.
Get the final set of lines.
This reconstructs the $to_lines parameter passed to the constructor.
Returns
array The sequence of strings.
|
public
|
#
_check( mixed $from_lines, mixed $to_lines )
Check a Diff for validity.
Check a Diff for validity.
This is here only for debugging purposes.
|
public 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
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
- $content
- string $content HTML content
- $cleaner
- object $cleaner Optional instance of a HTMLCleaner class to use, overriding
self::$html_cleaner_class
|
public static
|
|
public static
|
|
Magic methods summary
Properties summary
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the
Silverstripe Forums to ask development related questions.
-