MediaWiki master
Wikimedia\Diff\UnifiedDiffFormatter Class Reference

A formatter that outputs unified diffs. More...

Inherits Wikimedia\Diff\DiffFormatter.

Collaboration diagram for Wikimedia\Diff\UnifiedDiffFormatter:

Protected Member Functions

 added ( $lines)
 
 blockHeader ( $xbeg, $xlen, $ybeg, $ylen)
 
 changed ( $orig, $closing)
 
 deleted ( $lines)
 
 lines ( $lines, $prefix=' ')
 
- Protected Member Functions inherited from Wikimedia\Diff\DiffFormatter
 block ( $xbeg, $xlen, $ybeg, $ylen, &$edits)
 
 context ( $lines)
 
 endBlock ()
 Called at the end of a block of connected edits.
 
 endDiff ()
 
 startBlock ( $header)
 Called at the start of a block of connected edits.
 
 startDiff ()
 
 writeOutput ( $text)
 Writes a string to the output buffer.
 

Protected Attributes

int $leadingContextLines = 2
 
int $trailingContextLines = 2
 
- Protected Attributes inherited from Wikimedia\Diff\DiffFormatter
int $leadingContextLines = 0
 Number of leading context "lines" to preserve.
 
int $trailingContextLines = 0
 Number of trailing context "lines" to preserve.
 

Additional Inherited Members

- Public Member Functions inherited from Wikimedia\Diff\DiffFormatter
 format ( $diff)
 Format a diff.
 

Detailed Description

A formatter that outputs unified diffs.

Stability: newable

Definition at line 34 of file UnifiedDiffFormatter.php.

Member Function Documentation

◆ added()

Wikimedia\Diff\UnifiedDiffFormatter::added ( $lines)
protected
Parameters
string[]$lines

Reimplemented from Wikimedia\Diff\DiffFormatter.

Definition at line 55 of file UnifiedDiffFormatter.php.

References $lines, and Wikimedia\Diff\UnifiedDiffFormatter\lines().

Referenced by Wikimedia\Diff\UnifiedDiffFormatter\changed().

◆ blockHeader()

Wikimedia\Diff\UnifiedDiffFormatter::blockHeader ( $xbeg,
$xlen,
$ybeg,
$ylen )
protected
Parameters
int$xbeg
int$xlen
int$ybeg
int$ylen
Returns
string

Reimplemented from Wikimedia\Diff\DiffFormatter.

Definition at line 83 of file UnifiedDiffFormatter.php.

◆ changed()

Wikimedia\Diff\UnifiedDiffFormatter::changed ( $orig,
$closing )
protected
Parameters
string[]$orig
string[]$closing

Reimplemented from Wikimedia\Diff\DiffFormatter.

Definition at line 70 of file UnifiedDiffFormatter.php.

References Wikimedia\Diff\UnifiedDiffFormatter\added(), and Wikimedia\Diff\UnifiedDiffFormatter\deleted().

◆ deleted()

Wikimedia\Diff\UnifiedDiffFormatter::deleted ( $lines)
protected
Parameters
string[]$lines

Reimplemented from Wikimedia\Diff\DiffFormatter.

Definition at line 62 of file UnifiedDiffFormatter.php.

References $lines, and Wikimedia\Diff\UnifiedDiffFormatter\lines().

Referenced by Wikimedia\Diff\UnifiedDiffFormatter\changed().

◆ lines()

Wikimedia\Diff\UnifiedDiffFormatter::lines ( $lines,
$prefix = ' ' )
protected
Parameters
string[]$lines
string$prefix

Reimplemented from Wikimedia\Diff\DiffFormatter.

Definition at line 46 of file UnifiedDiffFormatter.php.

References $lines, and Wikimedia\Diff\DiffFormatter\writeOutput().

Referenced by Wikimedia\Diff\UnifiedDiffFormatter\added(), and Wikimedia\Diff\UnifiedDiffFormatter\deleted().

Member Data Documentation

◆ $leadingContextLines

int Wikimedia\Diff\UnifiedDiffFormatter::$leadingContextLines = 2
protected

Definition at line 37 of file UnifiedDiffFormatter.php.

◆ $trailingContextLines

int Wikimedia\Diff\UnifiedDiffFormatter::$trailingContextLines = 2
protected

Definition at line 40 of file UnifiedDiffFormatter.php.


The documentation for this class was generated from the following file: