Documentation

StrictUnifiedDiffOutputBuilder
in package
implements DiffOutputBuilderInterface

Strict Unified diff output builder.

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

Interfaces, Classes, Traits and Enums

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
__construct()  : mixed
getDiff()  : string
assertString()  : void
assertStringOrNull()  : void
writeDiffHunks()  : void
writeHunk()  : void

Properties

$default

private static mixed $default = [ 'collapseRanges' => true, // ranges of length one are rendered with the trailing `,1` 'commonLineThreshold' => 6, // number of same lines before ending a new hunk and creating a new one (if needed) 'contextLines' => 3, // like `diff: -u, -U NUM, --unified[=NUM]`, for patch/git apply compatibility best to keep at least @ 3 'fromFile' => null, 'fromFileDate' => null, 'toFile' => null, 'toFileDate' => null, ]

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

assertString()

private assertString(array<string|int, mixed> $options, string $option) : void
Parameters
$options : array<string|int, mixed>
$option : string
Return values
void

assertStringOrNull()

private assertStringOrNull(array<string|int, mixed> $options, string $option) : void
Parameters
$options : array<string|int, mixed>
$option : string
Return values
void

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