MediaWiki REL1_40
|
Base class for diff formatters. More...
Inherited by ArrayDiffFormatter, TableDiffFormatter, and 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 36 of file DiffFormatter.php.
|
protected |
string[] | $lines |
Reimplemented in TableDiffFormatter, and UnifiedDiffFormatter.
Definition at line 231 of file DiffFormatter.php.
|
protected |
int | $xbeg | |
int | $xlen | |
int | $ybeg | |
int | $ylen | |
array | &$edits |
MWException | If the edit type is not known. |
Definition at line 132 of file DiffFormatter.php.
References added(), blockHeader(), changed(), context(), deleted(), endBlock(), and startBlock().
Referenced by format().
|
protected |
int | $xbeg | |
int | $xlen | |
int | $ybeg | |
int | $ylen |
Reimplemented in TableDiffFormatter, and UnifiedDiffFormatter.
Definition at line 181 of file DiffFormatter.php.
Referenced by block().
|
protected |
Writes the two sets of lines to the output buffer, separated by "---" and a newline.
string[] | $orig | |
string[] | $closing |
Reimplemented in TableDiffFormatter, and UnifiedDiffFormatter.
Definition at line 248 of file DiffFormatter.php.
References added(), deleted(), and writeOutput().
Referenced by block().
|
protected |
string[] | $lines |
Reimplemented in TableDiffFormatter.
Definition at line 224 of file DiffFormatter.php.
References $lines, and lines().
Referenced by block().
|
protected |
string[] | $lines |
Reimplemented in TableDiffFormatter, and UnifiedDiffFormatter.
Definition at line 238 of file DiffFormatter.php.
|
protected |
Called at the end of a block of connected edits.
This default implementation does nothing.
Reimplemented in TableDiffFormatter.
Definition at line 206 of file DiffFormatter.php.
Referenced by block().
|
protected |
DiffFormatter::format | ( | $diff | ) |
Format a diff.
Diff | $diff |
Reimplemented in ArrayDiffFormatter.
Definition at line 62 of file DiffFormatter.php.
References $leadingContextLines, $trailingContextLines, block(), endDiff(), and startDiff().
|
protected |
Writes all (optionally prefixed) lines to the output buffer, separated by newlines.
string[] | $lines | |
string | $prefix |
Reimplemented in UnifiedDiffFormatter.
Definition at line 215 of file DiffFormatter.php.
References $lines, and writeOutput().
|
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 TableDiffFormatter.
Definition at line 198 of file DiffFormatter.php.
References $header, and writeOutput().
Referenced by block().
|
protected |
Definition at line 150 of file DiffFormatter.php.
Referenced by format().
|
protected |
Writes a string to the output buffer.
string | $text |
Definition at line 159 of file DiffFormatter.php.
Referenced by TableDiffFormatter\added(), changed(), TableDiffFormatter\changed(), TableDiffFormatter\context(), TableDiffFormatter\deleted(), lines(), UnifiedDiffFormatter\lines(), startBlock(), and 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 43 of file DiffFormatter.php.
Referenced by 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 50 of file DiffFormatter.php.
Referenced by format().