Documentation

StrictUnifiedDiffOutputBuilder
in package
implements DiffOutputBuilderInterface

FinalYes

Strict Unified diff output builder.

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

Table of Contents

Interfaces

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

Properties

$changed  : bool
$collapseRanges  : bool
$commonLineThreshold  : int
$contextLines  : int
$default  : mixed
$header  : string

Methods

__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> = []

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

assertStringOrNull()

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

writeDiffHunks()

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

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

        
On this page

Search results