Documentation

UnifiedDiffOutputBuilder
in package
implements DiffOutputBuilderInterface

Strict Unified diff output builder.

Tags
name

Unified diff output builder

description

Generates (strict) Unified diff's (unidiffs) with hunks.

author

SpacePossum

Interfaces, Classes and Traits

DiffOutputBuilderInterface
Defines how an output builder should take a generated diff array and return a string representation of that diff.

Table of Contents

$changed  : bool
$collapseRanges  : bool
$commonLineThreshold  : int
$contextLines  : int
$default  : mixed
$header  : string
$noNewlineAtOEFid  : int
__construct()  : mixed
getDiff()  : mixed
writeDiffHunks()  : mixed
writeHunk()  : mixed

Properties

$default

private static mixed $default = [ 'contextLines' => 3, // like `diff: -u, -U NUM, --unified[=NUM]`, for patch/git apply compatibility best to keep at least @ 3 'collapseRanges' => true, // ranges of length one are rendered with the trailing `,1` 'fromFile' => null, 'fromFileDate' => null, 'toFile' => null, 'toFileDate' => null, 'commonLineThreshold' => 6, ]

Methods

__construct()

public __construct([array<string|int, mixed> $options = [] ]) : mixed
Parameters
$options : array<string|int, mixed> = []
Return values
mixed

getDiff()

public getDiff(array<string|int, mixed> $diff) : mixed
Parameters
$diff : array<string|int, mixed>
Return values
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
Return values
mixed

Search results