Class Text_Diff_Engine_string

Description

Parses unified or context diffs output from eg. the diff utility.

Example:

  1.  $patch file_get_contents('example.patch');
  2.  $diff new Text_Diff('string'array($patch));
  3.  $renderer new Text_Diff_Renderer_inline();
  4.  echo $renderer->render($diff);

$Horde: framework/Text_Diff/Diff/Engine/string.php,v 1.5.2.7 2009/07/24 13:04:43 jan Exp $

Copyright 2005 Örjan Persson <o@42mm.org> Copyright 2005-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://opensource.org/licenses/lgpl-license.php.

  • author: Örjan Persson <o@42mm.org>
  • since: 0.2.0

Located in /Text_Diff/Diff/Engine/string.php (line 25)


	
			
Method Summary
 array diff (string $diff, [string $mode = 'autodetect'])
 array parseContextDiff ( &$diff, array $diff)
 array parseUnifiedDiff (array $diff)
Methods
diff (line 40)

Parses a unified or context diff.

First param contains the whole diff and the second can be used to force a specific diff type. If the second parameter is 'autodetect', the diff will be examined to find out which type of diff this is.

  • return: List of all diff operations.
array diff (string $diff, [string $mode = 'autodetect'])
  • string $diff: The diff content.
  • string $mode: The diff mode of the content in $diff. One of 'context', 'unified', or 'autodetect'.
parseContextDiff (line 148)

Parses an array containing the context diff.

  • return: List of all diff operations.
array parseContextDiff ( &$diff, array $diff)
  • array $diff: Array of lines.
  • &$diff
parseUnifiedDiff (line 93)

Parses an array containing the unified diff.

  • return: List of all diff operations.
array parseUnifiedDiff (array $diff)
  • array $diff: Array of lines.

Documentation generated on Sun, 30 Jan 2011 05:22:26 +0000 by phpDocumentor 1.4.3