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