Overview

Packages

  • Text
    • Diff

Classes

  • Horde_Text_Diff
  • Horde_Text_Diff_Engine_Native
  • Horde_Text_Diff_Engine_Shell
  • Horde_Text_Diff_Engine_String
  • Horde_Text_Diff_Engine_Xdiff
  • Horde_Text_Diff_Exception
  • Horde_Text_Diff_Mapped
  • Horde_Text_Diff_Op_Add
  • Horde_Text_Diff_Op_Base
  • Horde_Text_Diff_Op_Change
  • Horde_Text_Diff_Op_Copy
  • Horde_Text_Diff_Op_Delete
  • Horde_Text_Diff_Renderer
  • Horde_Text_Diff_Renderer_Context
  • Horde_Text_Diff_Renderer_Inline
  • Horde_Text_Diff_Renderer_Unified
  • Horde_Text_Diff_ThreeWay
  • Horde_Text_Diff_ThreeWay_BlockBuilder
  • Horde_Text_Diff_ThreeWay_Op_Base
  • Horde_Text_Diff_ThreeWay_Op_Copy
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Text_Diff_Engine_String

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

Example:

$patch = file_get_contents('example.patch');
$diff = new Horde_Text_Diff('string', array($patch));
$renderer = new Horde_Text_Diff_Renderer_inline();
echo $renderer->render($diff);

Copyright 2005 Örjan Persson o@42mm.org Copyright 2005-2012 Horde LLC (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Package: Text\Diff
Author: Örjan Persson o@42mm.org
Located at Horde/Text/Diff/Engine/String.php
Methods summary
public array
# diff( string $diff, string $mode = 'autodetect' )

Parses a unified or context diff.

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.

Parameters

$diff
The diff content.
$mode
<p>The diff mode of the content in $diff. One of 'context', 'unified', or 'autodetect'.</p>

Returns

array
List of all diff operations.

Throws

Horde_Text_Diff_Exception
public array
# parseUnifiedDiff( array $diff )

Parses an array containing the unified diff.

Parses an array containing the unified diff.

Parameters

$diff
Array of lines.

Returns

array
List of all diff operations.
public array
# parseContextDiff( array & $diff )

Parses an array containing the context diff.

Parses an array containing the context diff.

Parameters

$diff
Array of lines.

Returns

array
List of all diff operations.
API documentation generated by ApiGen