class DiffFormatter extends DiffFormatter (View source)

Diff formatter which uses returns output that can be rendered to a table.

Properties

$show_header

Should a block header be shown?

from  DiffFormatter
$leading_context_lines

Number of leading context "lines" to preserve.

from  DiffFormatter
$trailing_context_lines

Number of trailing context "lines" to preserve.

from  DiffFormatter
protected array $line_stats

The line stats.

from  DiffFormatter
protected array $rows

The diff represented as an array of rows.

Methods

string
format(Diff $diff)

Format a diff.

_block($xbeg, $xlen, $ybeg, $ylen, $edits)

No description

_start_diff()

No description

_end_diff()

No description

_block_header($xbeg, $xlen, $ybeg, $ylen)

No description

_start_block($header)

No description

_end_block()

No description

_lines($lines, $prefix = ' ', $color = 'white')

No description

_context($lines)

No description

_added($lines)

No description

_deleted($lines)

No description

_changed($orig, $closing)

No description

__construct(ConfigFactoryInterface $config_factory)

Creates a DiffFormatter to render diffs in a table.

array
addedLine(string $line)

Creates an added line.

array
deletedLine(string $line)

Creates a deleted line.

array
contextLine(string $line)

Creates a context line.

array
emptyLine()

Creates an empty line.

Details

string format(Diff $diff)

Format a diff.

Parameters

Diff $diff

A Diff object.

Return Value

string

The formatted output.

protected _block($xbeg, $xlen, $ybeg, $ylen, $edits)

No description

Parameters

$xbeg
$xlen
$ybeg
$ylen
$edits

protected _start_diff()

No description

protected _end_diff()

No description

protected _block_header($xbeg, $xlen, $ybeg, $ylen)

No description

Parameters

$xbeg
$xlen
$ybeg
$ylen

protected _start_block($header)

No description

Parameters

$header

protected _end_block()

No description

protected _lines($lines, $prefix = ' ', $color = 'white')

No description

Parameters

$lines
$prefix
$color

protected _context($lines)

No description

Parameters

$lines

protected _added($lines)

No description

Parameters

$lines

protected _deleted($lines)

No description

Parameters

$lines

protected _changed($orig, $closing)

No description

Parameters

$orig
$closing

__construct(ConfigFactoryInterface $config_factory)

Creates a DiffFormatter to render diffs in a table.

Parameters

ConfigFactoryInterface $config_factory

The config factory.

protected array addedLine(string $line)

Creates an added line.

Parameters

string $line

An HTML-escaped line.

Return Value

array

An array representing a table row.

protected array deletedLine(string $line)

Creates a deleted line.

Parameters

string $line

An HTML-escaped line.

Return Value

array

An array representing a table row.

protected array contextLine(string $line)

Creates a context line.

Parameters

string $line

An HTML-escaped line.

Return Value

array

An array representing a table row.

protected array emptyLine()

Creates an empty line.

Return Value

array

An array representing a table row.