eZPublish  4.4
eZDiffTextEngine Class Reference

eZDiff provides an access point the diff system More...

+ Inheritance diagram for eZDiffTextEngine:
+ Collaboration diagram for eZDiffTextEngine:

Public Member Functions

 createDifferenceObject ($fromData, $toData)
 
 createOutput ($arr, $oldArray, $newArray)
 
 eZDiffTextEngine ()
 
 preProcess ($oldArray, $newArray)
 
- Public Member Functions inherited from eZDiffEngine
 createDifferenceObject ($fromData, $toData)
 

Private Member Functions

 addNewLine (&$text)
 
 buildDiff ($oldArray, $newArray)
 
 dumpMatrix ($arr, $rows, $cols)
 
 findLongestSubstringOffsets ($varArray)
 
 localSubstring ($direction, $row, $col, $rows, $cols, $matrix)
 
 postProcessDiff ($diffArray)
 
 substringMatrix ($old, $new)
 
 substringPlacement ($startOffset, $endOffset, $totalStringLength)
 
 substrings ($sub, $old, $new)
 
 traceSubstring ($row, $col, $matrix, $val, $new)
 
 trimEmptyArrayElements ($array)
 

Additional Inherited Members

- Public Attributes inherited from eZDiffEngine
 $DiffMode
 

Detailed Description

eZDiff provides an access point the diff system

The eZDiffEngine class is an abstract class, providing interface and shared code for the different available DiffEngine.

Member Function Documentation

eZDiffTextEngine::addNewLine ( $text)
private

This method will add a newline after unempty paragraphs

Referenced by createOutput().

eZDiffTextEngine::buildDiff (   $oldArray,
  $newArray 
)
private

This method will contruct a diff output for plain text.

Referenced by createOutput().

eZDiffTextEngine::createDifferenceObject (   $fromData,
  $toData 
)

This function calculates changes in plain text and creates an object to hold overview of changes.

eZDiffTextEngine::createOutput (   $arr,
  $oldArray,
  $newArray 
)

This Method will create the differences array which is processed by the templates

Referenced by createDifferenceObject().

eZDiffTextEngine::dumpMatrix (   $arr,
  $rows,
  $cols 
)
private

Helper method to matrices.

eZDiffTextEngine::eZDiffTextEngine ( )
eZDiffTextEngine::findLongestSubstringOffsets (   $varArray)
private

This method calculates the offsets in the old and new text for the longest common substring.

Referenced by substrings().

eZDiffTextEngine::localSubstring (   $direction,
  $row,
  $col,
  $rows,
  $cols,
  $matrix 
)
private

This method checks a patch of the length matrix for the longest substring. Depending on the $direction a sub matrix is searched for valid substrings.

Referenced by substrings().

eZDiffTextEngine::postProcessDiff (   $diffArray)
private

This method will chain together similar changes, in order to create a more connected output.

Referenced by buildDiff(), and createOutput().

eZDiffTextEngine::preProcess (   $oldArray,
  $newArray 
)

This method will determine which paragraphs which need to be diffed.

Referenced by createDifferenceObject().

eZDiffTextEngine::substringMatrix (   $old,
  $new 
)
private

This function find the longest common substrings in $old and $new It will build a matrix consisting of the length of detected substrings.

The function will build a structure like the following: array = ( 'maxLength' => 'maxRow' => 'maxCol' => 'lengthMatrix' => )

Returns
Matrix containing the length of longest common substring string and where it is found in the substring length matrix.

Referenced by buildDiff(), and preProcess().

eZDiffTextEngine::substringPlacement (   $startOffset,
  $endOffset,
  $totalStringLength 
)
private

This method will return an array with boolean values indicating whether the specified offsets $startOffset and $endOffset have additional text to either the left or right side.

Referenced by substrings().

eZDiffTextEngine::substrings (   $sub,
  $old,
  $new 
)
private

This method will detect discontinuous substrings in the matrix.

Returns
Array of substrings

Referenced by buildDiff(), and preProcess().

eZDiffTextEngine::traceSubstring (   $row,
  $col,
  $matrix,
  $val,
  $new 
)
private

This method will backtrace found substrings, it will start from the endpoint of the string and work towards its start.

Returns
Substring with endpoing at $row, $col

Referenced by substrings().

eZDiffTextEngine::trimEmptyArrayElements (   $array)
private

Removes empty elements from array

Returns
array without empty elements

The documentation for this class was generated from the following file: