ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Text_MappedDiff Class Reference
+ Inheritance diagram for Text_MappedDiff:
+ Collaboration diagram for Text_MappedDiff:

Public Member Functions

 Text_MappedDiff ($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines)
 Computes a diff between sequences of strings. More...
 
- Public Member Functions inherited from Text_Diff
 Text_Diff ($from_lines, $to_lines)
 Computes diffs between sequences of strings. More...
 
 getDiff ()
 Returns the array of differences. More...
 
 reverse ()
 Computes a reversed diff. More...
 
 isEmpty ()
 Checks for an empty diff. More...
 
 lcs ()
 Computes the length of the Longest Common Subsequence (LCS). More...
 
 getOriginal ()
 Gets the original set of lines. More...
 
 getFinal ()
 Gets the final set of lines. More...
 
 _trimNewlines (&$line, $key)
 Removes trailing newlines from a line of text. More...
 
 _check ($from_lines, $to_lines)
 Checks a diff for validity. More...
 

Additional Inherited Members

- Data Fields inherited from Text_Diff
 $_edits
 

Detailed Description

Definition at line 201 of file Diff.php.

Member Function Documentation

◆ Text_MappedDiff()

Text_MappedDiff::Text_MappedDiff (   $from_lines,
  $to_lines,
  $mapped_from_lines,
  $mapped_to_lines 
)

Computes a diff between sequences of strings.

This can be used to compute things like case-insensitve diffs, or diffs which ignore changes in white-space.

Parameters
array$from_linesAn array of strings.
array$to_linesAn array of strings.
array$mapped_from_linesThis array should have the same size number of elements as $from_lines. The elements in $mapped_from_lines and $mapped_to_lines are what is actually compared when computing the diff.
array$mapped_to_linesThis array should have the same number of elements as $to_lines.

Definition at line 219 of file Diff.php.

221 {
222 assert(count($from_lines) == count($mapped_from_lines));
223 assert(count($to_lines) == count($mapped_to_lines));
224
225 parent::Text_Diff($mapped_from_lines, $mapped_to_lines);
226
227 $xi = $yi = 0;
228 for ($i = 0; $i < count($this->_edits); $i++) {
229 $orig = &$this->_edits[$i]->orig;
230 if (is_array($orig)) {
231 $orig = array_slice($from_lines, $xi, count($orig));
232 $xi += count($orig);
233 }
234
235 $final = &$this->_edits[$i]->final;
236 if (is_array($final)) {
237 $final = array_slice($to_lines, $yi, count($final));
238 $yi += count($final);
239 }
240 }
241 }

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