UnifiedDiffOutputBuilder
extends AbstractChunkOutputBuilder
in package
Builds a diff string representation in unified diff format in chunks.
Table of Contents
- $addLineNumbers : bool
- $header : string
- __construct() : mixed
- getDiff() : mixed
- getCommonChunks() : array<string|int, mixed>
- Takes input of the diff array and returns the common parts.
- getChunkRange() : mixed
- writeChunk() : mixed
- writeDiffChunked() : mixed
Properties
$addLineNumbers
private
bool
$addLineNumbers
$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> —getChunkRange()
private
getChunkRange(array<string|int, mixed> $diff, mixed $diffStartIndex, mixed $diffEndIndex) : mixed
Parameters
- $diff : array<string|int, mixed>
- $diffStartIndex : mixed
- $diffEndIndex : mixed
Return values
mixed —writeChunk()
private
writeChunk(mixed $output, array<string|int, mixed> $diff, mixed $diffStartIndex, mixed $diffEndIndex, mixed $fromStart, mixed $fromRange, mixed $toStart, mixed $toRange) : mixed
Parameters
- $output : mixed
- $diff : array<string|int, mixed>
- $diffStartIndex : mixed
- $diffEndIndex : mixed
- $fromStart : mixed
- $fromRange : mixed
- $toStart : mixed
- $toRange : mixed
Return values
mixed —writeDiffChunked()
private
writeDiffChunked(mixed $output, array<string|int, mixed> $diff, array<string|int, mixed> $old) : mixed
Parameters
- $output : mixed
- $diff : array<string|int, mixed>
- $old : array<string|int, mixed>