Documentation

UnifiedDiffOutputBuilder extends AbstractChunkOutputBuilder
in package

Builds a diff string representation in unified diff format in chunks.

Table of Contents

$addLineNumbers  : bool
$collapseRanges  : bool
$commonLineThreshold  : int
$contextLines  : int
$header  : string
__construct()  : mixed
getDiff()  : string
getCommonChunks()  : array<string|int, mixed>
Takes input of the diff array and returns the common parts.
writeDiffHunks()  : void
writeHunk()  : void

Properties

Methods

__construct()

public __construct([string $header = "--- Original +++ New " ][, bool $addLineNumbers = false ]) : mixed
Parameters
$header : string = "--- Original +++ New "
$addLineNumbers : bool = false
Return values
mixed

getDiff()

public getDiff(array<string|int, mixed> $diff) : string
Parameters
$diff : array<string|int, mixed>
Return values
string

getCommonChunks()

Takes input of the diff array and returns the common parts.

protected getCommonChunks(array<string|int, mixed> $diff[, int $lineThreshold = 5 ]) : array<string|int, mixed>

Iterates through diff line by line.

Parameters
$diff : array<string|int, mixed>
$lineThreshold : int = 5
Return values
array<string|int, mixed>

writeDiffHunks()

private writeDiffHunks(mixed $output, array<string|int, mixed> $diff) : void
Parameters
$output : mixed
$diff : array<string|int, mixed>
Return values
void

writeHunk()

private writeHunk(array<string|int, mixed> $diff, int $diffStartIndex, int $diffEndIndex, int $fromStart, int $fromRange, int $toStart, int $toRange, mixed $output) : void
Parameters
$diff : array<string|int, mixed>
$diffStartIndex : int
$diffEndIndex : int
$fromStart : int
$fromRange : int
$toStart : int
$toRange : int
$output : mixed
Return values
void

Search results