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() : mixed
- getCommonChunks() : array<string|int, mixed>
- Takes input of the diff array and returns the common parts.
- writeDiffHunks() : mixed
- writeHunk() : mixed
Properties
$addLineNumbers
private
bool
$addLineNumbers
$collapseRanges
private
bool
$collapseRanges
= true
$commonLineThreshold
private
int
$commonLineThreshold
= 6
$contextLines
private
int
$contextLines
= 3
$header
private
string
$header
Methods
__construct()
public
__construct([mixed $header = "--- Original
+++ New
" ][, mixed $addLineNumbers = false ]) : mixed
Parameters
- $header : mixed = "--- Original +++ New "
- $addLineNumbers : mixed = false
Return values
mixed —getDiff()
public
getDiff(array<string|int, mixed> $diff) : mixed
Parameters
- $diff : array<string|int, mixed>
Return values
mixed —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) : mixed
Parameters
- $output : mixed
- $diff : array<string|int, mixed>
Return values
mixed —writeHunk()
private
writeHunk(array<string|int, mixed> $diff, mixed $diffStartIndex, mixed $diffEndIndex, mixed $fromStart, mixed $fromRange, mixed $toStart, mixed $toRange, mixed $output) : mixed
Parameters
- $diff : array<string|int, mixed>
- $diffStartIndex : mixed
- $diffEndIndex : mixed
- $fromStart : mixed
- $fromRange : mixed
- $toStart : mixed
- $toRange : mixed
- $output : mixed