MediaWiki REL1_41
|
Base class for diff formatters. More...
Inherited by Wikimedia\Diff\ArrayDiffFormatter, Wikimedia\Diff\TableDiffFormatter, and Wikimedia\Diff\UnifiedDiffFormatter.
Public Member Functions | |
format ( $diff) | |
Format a diff. | |
Protected Member Functions | |
added ( $lines) | |
block ( $xbeg, $xlen, $ybeg, $ylen, &$edits) | |
blockHeader ( $xbeg, $xlen, $ybeg, $ylen) | |
changed ( $orig, $closing) | |
Writes the two sets of lines to the output buffer, separated by "---" and a newline. | |
context ( $lines) | |
deleted ( $lines) | |
endBlock () | |
Called at the end of a block of connected edits. | |
endDiff () | |
lines ( $lines, $prefix=' ') | |
Writes all (optionally prefixed) lines to the output buffer, separated by newlines. | |
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 = 0 |
Number of leading context "lines" to preserve. | |
int | $trailingContextLines = 0 |
Number of trailing context "lines" to preserve. | |
Base class for diff formatters.
This class formats the diff in classic diff format. It is intended that this class be customized via inheritance, to obtain fancier outputs.
Definition at line 40 of file DiffFormatter.php.
|
protected |
string[] | $lines |
Reimplemented in Wikimedia\Diff\TableDiffFormatter, and Wikimedia\Diff\UnifiedDiffFormatter.
Definition at line 233 of file DiffFormatter.php.
References $lines, and Wikimedia\Diff\DiffFormatter\lines().
Referenced by Wikimedia\Diff\DiffFormatter\block(), and Wikimedia\Diff\DiffFormatter\changed().
|
protected |
int | $xbeg | |
int | $xlen | |
int | $ybeg | |
int | $ylen | |
array | &$edits |
Definition at line 134 of file DiffFormatter.php.
References Wikimedia\Diff\DiffFormatter\added(), Wikimedia\Diff\DiffFormatter\blockHeader(), Wikimedia\Diff\DiffFormatter\changed(), Wikimedia\Diff\DiffFormatter\context(), Wikimedia\Diff\DiffFormatter\deleted(), Wikimedia\Diff\DiffFormatter\endBlock(), and Wikimedia\Diff\DiffFormatter\startBlock().
Referenced by Wikimedia\Diff\DiffFormatter\format().
|
protected |
int | $xbeg | |
int | $xlen | |
int | $ybeg | |
int | $ylen |
Reimplemented in Wikimedia\Diff\TableDiffFormatter, and Wikimedia\Diff\UnifiedDiffFormatter.
Definition at line 183 of file DiffFormatter.php.
Referenced by Wikimedia\Diff\DiffFormatter\block().
|
protected |
Writes the two sets of lines to the output buffer, separated by "---" and a newline.
string[] | $orig | |
string[] | $closing |
Reimplemented in Wikimedia\Diff\TableDiffFormatter, and Wikimedia\Diff\UnifiedDiffFormatter.
Definition at line 250 of file DiffFormatter.php.
References Wikimedia\Diff\DiffFormatter\added(), Wikimedia\Diff\DiffFormatter\deleted(), and Wikimedia\Diff\DiffFormatter\writeOutput().
Referenced by Wikimedia\Diff\DiffFormatter\block().
|
protected |
string[] | $lines |
Reimplemented in Wikimedia\Diff\TableDiffFormatter.
Definition at line 226 of file DiffFormatter.php.
References $lines, and Wikimedia\Diff\DiffFormatter\lines().
Referenced by Wikimedia\Diff\DiffFormatter\block().
|
protected |
string[] | $lines |
Reimplemented in Wikimedia\Diff\TableDiffFormatter, and Wikimedia\Diff\UnifiedDiffFormatter.
Definition at line 240 of file DiffFormatter.php.
References $lines, and Wikimedia\Diff\DiffFormatter\lines().
Referenced by Wikimedia\Diff\DiffFormatter\block(), and Wikimedia\Diff\DiffFormatter\changed().
|
protected |
Called at the end of a block of connected edits.
This default implementation does nothing.
Reimplemented in Wikimedia\Diff\TableDiffFormatter.
Definition at line 208 of file DiffFormatter.php.
Referenced by Wikimedia\Diff\DiffFormatter\block().
|
protected |
Definition at line 168 of file DiffFormatter.php.
Referenced by Wikimedia\Diff\DiffFormatter\format().
Wikimedia\Diff\DiffFormatter::format | ( | $diff | ) |
Format a diff.
Diff | $diff |
Reimplemented in Wikimedia\Diff\ArrayDiffFormatter.
Definition at line 66 of file DiffFormatter.php.
References Wikimedia\Diff\DiffFormatter\$leadingContextLines, Wikimedia\Diff\DiffFormatter\$trailingContextLines, Wikimedia\Diff\DiffFormatter\block(), Wikimedia\Diff\DiffFormatter\endDiff(), and Wikimedia\Diff\DiffFormatter\startDiff().
|
protected |
Writes all (optionally prefixed) lines to the output buffer, separated by newlines.
string[] | $lines | |
string | $prefix |
Reimplemented in Wikimedia\Diff\UnifiedDiffFormatter.
Definition at line 217 of file DiffFormatter.php.
References $lines, and Wikimedia\Diff\DiffFormatter\writeOutput().
Referenced by Wikimedia\Diff\DiffFormatter\added(), Wikimedia\Diff\DiffFormatter\context(), and Wikimedia\Diff\DiffFormatter\deleted().
|
protected |
Called at the start of a block of connected edits.
This default implementation writes the header and a newline to the output buffer.
string | $header |
Reimplemented in Wikimedia\Diff\TableDiffFormatter.
Definition at line 200 of file DiffFormatter.php.
References $header, and Wikimedia\Diff\DiffFormatter\writeOutput().
Referenced by Wikimedia\Diff\DiffFormatter\block().
|
protected |
Definition at line 152 of file DiffFormatter.php.
Referenced by Wikimedia\Diff\DiffFormatter\format().
|
protected |
Writes a string to the output buffer.
string | $text |
Definition at line 161 of file DiffFormatter.php.
Referenced by Wikimedia\Diff\TableDiffFormatter\added(), Wikimedia\Diff\DiffFormatter\changed(), Wikimedia\Diff\TableDiffFormatter\changed(), Wikimedia\Diff\TableDiffFormatter\context(), Wikimedia\Diff\TableDiffFormatter\deleted(), Wikimedia\Diff\DiffFormatter\lines(), Wikimedia\Diff\UnifiedDiffFormatter\lines(), Wikimedia\Diff\DiffFormatter\startBlock(), and Wikimedia\Diff\TableDiffFormatter\startBlock().
|
protected |
Number of leading context "lines" to preserve.
This should be left at zero for this class, but subclasses may want to set this to other values.
Definition at line 47 of file DiffFormatter.php.
Referenced by Wikimedia\Diff\DiffFormatter\format().
|
protected |
Number of trailing context "lines" to preserve.
This should be left at zero for this class, but subclasses may want to set this to other values.
Definition at line 54 of file DiffFormatter.php.
Referenced by Wikimedia\Diff\DiffFormatter\format().