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 }
Base class for diff formatters.
writeOutput( $text)
Writes a string to the output buffer.
A formatter that outputs unified diffs.
blockHeader( $xbeg, $xlen, $ybeg, $ylen)
lines( $lines, $prefix=' ')
changed( $orig, $closing)
$line
Definition: mcc.php:119
if(!file_exists( $CREDITS)) $lines