MediaWiki  master
UnifiedDiffFormatter.php
Go to the documentation of this file.
1 <?php
33 
35  protected $leadingContextLines = 2;
36 
38  protected $trailingContextLines = 2;
39 
44  protected function lines( $lines, $prefix = ' ' ) {
45  foreach ( $lines as $line ) {
46  $this->writeOutput( "{$prefix}{$line}\n" );
47  }
48  }
49 
53  protected function added( $lines ) {
54  $this->lines( $lines, '+' );
55  }
56 
60  protected function deleted( $lines ) {
61  $this->lines( $lines, '-' );
62  }
63 
68  protected function changed( $orig, $closing ) {
69  $this->deleted( $orig );
70  $this->added( $closing );
71  }
72 
81  protected function blockHeader( $xbeg, $xlen, $ybeg, $ylen ) {
82  return "@@ -$xbeg,$xlen +$ybeg,$ylen @@";
83  }
84 
85 }
DiffFormatter
Base class for diff formatters.
Definition: DiffFormatter.php:36
UnifiedDiffFormatter\changed
changed( $orig, $closing)
Definition: UnifiedDiffFormatter.php:68
UnifiedDiffFormatter\deleted
deleted( $lines)
Definition: UnifiedDiffFormatter.php:60
UnifiedDiffFormatter\$trailingContextLines
int $trailingContextLines
Definition: UnifiedDiffFormatter.php:38
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:81
UnifiedDiffFormatter\lines
lines( $lines, $prefix=' ')
Definition: UnifiedDiffFormatter.php:44
UnifiedDiffFormatter
A formatter that outputs unified diffs @newable.
Definition: UnifiedDiffFormatter.php:32
$line
$line
Definition: mcc.php:119
UnifiedDiffFormatter\$leadingContextLines
int $leadingContextLines
Definition: UnifiedDiffFormatter.php:35
$lines
if(!file_exists( $CREDITS)) $lines
Definition: updateCredits.php:49
UnifiedDiffFormatter\added
added( $lines)
Definition: UnifiedDiffFormatter.php:53