\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-2017 Horde LLC (http://www.horde.org/)

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

Summary

Methods
Properties
Constants
diff()
parseUnifiedDiff()
parseContextDiff()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

diff()

diff(string  $diff, string  $mode = 'autodetect') : array

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

string $diff

The diff content.

string $mode

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

Throws

\Horde_Text_Diff_Exception

Returns

array —

List of all diff operations.

parseUnifiedDiff()

parseUnifiedDiff(array  $diff) : array

Parses an array containing the unified diff.

Parameters

array $diff

Array of lines.

Returns

array —

List of all diff operations.

parseContextDiff()

parseContextDiff(array  $diff) : array

Parses an array containing the context diff.

Parameters

array $diff

Array of lines.

Returns

array —

List of all diff operations.