Property | Type | Description | |
---|---|---|---|
$changes | array | ||
$editCost | Cost of an empty edit operation in terms of edit characters. | ||
$timeout | Number of seconds to map a diff before giving up (0 for infinity). | ||
$toolkit |
Method | Description | |
---|---|---|
__construct ( string | null $text1 = null, string | null $text2 = null ) | Init object and call main(), if texts passed. | |
cleanupEfficiency ( ) | Reduce the number of edits by eliminating operationally trivial equalities. | |
cleanupMerge ( ) | Reorder and merge like edit sections. Merge equalities. | |
cleanupSemantic ( ) | Reduce the number of edits by eliminating semantically trivial equalities. | |
cleanupSemanticLossless ( ) | Look for single edits surrounded on both sides by equalities which can be shifted sideways to align the edit to a word boundary. | |
fromDelta ( string $text1, string $delta ) | Given the original text1, and an encoded string which describes the operations required to transform text1 into text2, compute the full diff. | |
getChanges ( ) : array | ||
getEditCost ( ) : integer | ||
getTimeout ( ) : float | ||
getToolkit ( ) : |
||
levenshtein ( ) : integer | Compute the Levenshtein distance; the number of inserted, deleted or substituted characters. | |
main ( string $text1, string $text2, boolean $checklines = true, integer $deadline = null ) : self | Find the differences between two texts. Simplifies the problem by stripping any common prefix or suffix off the texts before diffing. | |
prettyHtml ( ) : string | Convert a diff array into a pretty HTML report. | |
setChanges ( array $changes ) | ||
setEditCost ( integer $editCost ) | ||
setTimeout ( $timeout ) | ||
setToolkit ( |
||
text1 ( ) : string | Compute and return the source text (all equalities and deletions). | |
text2 ( ) : string | Compute and return the destination text (all equalities and insertions). | |
toDelta ( ) : string | Crush the diff into an encoded string which describes the operations required to transform text1 into text2. | |
xIndex ( integer $loc ) : integer | Compute and return location in text2 equivalent to the $loc in text1. |
Method | Description | |
---|---|---|
bisect ( string $text1, string $text2, integer $deadline ) : array | Find the 'middle snake' of a diff, split the problem in two and return the recursively constructed diff. | |
bisectSplit ( string $text1, string $text2, integer $x, integer $y, integer $deadline ) : array | Given the location of the 'middle snake', split the diff in two parts and recurse. | |
cleanupSemanticScore ( string $one, string $two ) : integer | Given two strings, compute a score representing whether the internal boundary falls on logical boundaries. | |
compute ( string $text1, string $text2, boolean $checklines, integer $deadline ) : array | Find the differences between two texts. Assumes that the texts do not have any common prefix or suffix. | |
lineMode ( string $text1, string $text2, integer $deadline ) : array | Do a quick line-level diff on both strings, then rediff the parts for greater accuracy. |
protected bisectSplit ( string $text1, string $text2, integer $x, integer $y, integer $deadline ) : array | ||
$text1 | string | Old string to be diffed. |
$text2 | string | New string to be diffed. |
$x | integer | Index of split point in text1. |
$y | integer | Index of split point in text2. |
$deadline | integer | Time at which to bail if not yet complete. |
return | array | Array of diff arrays. |
public cleanupMerge ( ) |
public cleanupSemanticLossless ( ) |
protected compute ( string $text1, string $text2, boolean $checklines, integer $deadline ) : array | ||
$text1 | string | Old string to be diffed. |
$text2 | string | New string to be diffed. |
$checklines | boolean | Speedup flag. If false, then don't run a line-level diff first to identify the changed areas. If true, then run a faster, slightly less optimal diff. |
$deadline | integer | Time when the diff should be complete by. |
return | array | Array of changes. |
public levenshtein ( ) : integer | ||
return | integer | Number of changes. |
public main ( string $text1, string $text2, boolean $checklines = true, integer $deadline = null ) : self | ||
$text1 | string | Old string to be diffed. |
$text2 | string | New string to be diffed. |
$checklines | boolean | Optional speedup flag. If present and false, then don't run a line-level diff first to identify the changed areas. Defaults to true, which does a faster, slightly less optimal diff. |
$deadline | integer | Optional time when the diff should be complete by. Used internally for recursive calls. Users should set $this->timeout instead. |
return | self |
public prettyHtml ( ) : string | ||
return | string | HTML representation. |
protected $editCost |
protected $timeout |