Parses unified or context diffs output from eg. the diff utility.
Example:
$patch = file_get_contents('example.patch');
$diff = new Text_Diff('string', array($patch));
$renderer = new Text_Diff_Renderer_inline();
echo $renderer->render($diff);
Copyright 2005 Örjan Persson o@42mm.org Copyright 2005-2010 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 |
---|---|
package | Text_Diff |
since | 0.2.0 |
diff(string $diff, string $mode = 'autodetect'
) : array
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.
string
The diff content.
string
The diff mode of the content in $diff. One of 'context', 'unified', or 'autodetect'.
array
List of all diff operations.parseContextDiff(array $diff) : array
array
Array of lines.
array
List of all diff operations.parseUnifiedDiff(array $diff) : array
array
Array of lines.
array
List of all diff operations.