MediaWiki  1.34.0
UnifiedDiffFormatter.php
Go to the documentation of this file.
1 <?php
32 
34  protected $leadingContextLines = 2;
35 
37  protected $trailingContextLines = 2;
38 
43  protected function lines( $lines, $prefix = ' ' ) {
44  foreach ( $lines as $line ) {
45  $this->writeOutput( "{$prefix}{$line}\n" );
46  }
47  }
48 
52  protected function added( $lines ) {
53  $this->lines( $lines, '+' );
54  }
55 
59  protected function deleted( $lines ) {
60  $this->lines( $lines, '-' );
61  }
62 
67  protected function changed( $orig, $closing ) {
68  $this->deleted( $orig );
69  $this->added( $closing );
70  }
71 
80  protected function blockHeader( $xbeg, $xlen, $ybeg, $ylen ) {
81  return "@@ -$xbeg,$xlen +$ybeg,$ylen @@";
82  }
83 
84 }
DiffFormatter
Base class for diff formatters.
Definition: DiffFormatter.php:36
UnifiedDiffFormatter\changed
changed( $orig, $closing)
Definition: UnifiedDiffFormatter.php:67
UnifiedDiffFormatter\deleted
deleted( $lines)
Definition: UnifiedDiffFormatter.php:59
UnifiedDiffFormatter\$trailingContextLines
int $trailingContextLines
Definition: UnifiedDiffFormatter.php:37
DiffFormatter\writeOutput
writeOutput( $text)
Writes a string to the output buffer.
Definition: DiffFormatter.php:159
UnifiedDiffFormatter\blockHeader
blockHeader( $xbeg, $xlen, $ybeg, $ylen)
Definition: UnifiedDiffFormatter.php:80
UnifiedDiffFormatter\lines
lines( $lines, $prefix=' ')
Definition: UnifiedDiffFormatter.php:43
$lines
$lines
Definition: router.php:61
UnifiedDiffFormatter
A formatter that outputs unified diffs.
Definition: UnifiedDiffFormatter.php:31
$line
$line
Definition: cdb.php:59
UnifiedDiffFormatter\$leadingContextLines
int $leadingContextLines
Definition: UnifiedDiffFormatter.php:34
UnifiedDiffFormatter\added
added( $lines)
Definition: UnifiedDiffFormatter.php:52