Documentation

Horde_Text_Diff_Engine_String
in package

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.

Tags
author

Örjan Persson o@42mm.org

Table of Contents

diff()  : array<string|int, mixed>
Parses a unified or context diff.
parseContextDiff()  : array<string|int, mixed>
Parses an array containing the context diff.
parseUnifiedDiff()  : array<string|int, mixed>
Parses an array containing the unified diff.

Methods

diff()

Parses a unified or context diff.

public diff(string $diff[, string $mode = 'autodetect' ]) : array<string|int, mixed>

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 : string

The diff content.

$mode : string = 'autodetect'

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

Tags
throws
Horde_Text_Diff_Exception
Return values
array<string|int, mixed>

List of all diff operations.

parseContextDiff()

Parses an array containing the context diff.

public parseContextDiff(array<string|int, mixed> &$diff) : array<string|int, mixed>
Parameters
$diff : array<string|int, mixed>

Array of lines.

Return values
array<string|int, mixed>

List of all diff operations.

parseUnifiedDiff()

Parses an array containing the unified diff.

public parseUnifiedDiff(array<string|int, mixed> $diff) : array<string|int, mixed>
Parameters
$diff : array<string|int, mixed>

Array of lines.

Return values
array<string|int, mixed>

List of all diff operations.

Search results