MediaWiki REL1_31
ArrayDiffFormatter.php
Go to the documentation of this file.
1<?php
32
38 public function format( $diff ) {
39 $oldline = 1;
40 $newline = 1;
41 $retval = [];
42 foreach ( $diff->getEdits() as $edit ) {
43 switch ( $edit->getType() ) {
44 case 'add':
45 foreach ( $edit->getClosing() as $line ) {
46 $retval[] = [
47 'action' => 'add',
48 'new' => $line,
49 'newline' => $newline++
50 ];
51 }
52 break;
53 case 'delete':
54 foreach ( $edit->getOrig() as $line ) {
55 $retval[] = [
56 'action' => 'delete',
57 'old' => $line,
58 'oldline' => $oldline++,
59 ];
60 }
61 break;
62 case 'change':
63 foreach ( $edit->getOrig() as $key => $line ) {
64 $retval[] = [
65 'action' => 'change',
66 'old' => $line,
67 'new' => $edit->getClosing( $key ),
68 'oldline' => $oldline++,
69 'newline' => $newline++,
70 ];
71 }
72 break;
73 case 'copy':
74 $oldline += count( $edit->getOrig() );
75 $newline += count( $edit->getOrig() );
76 }
77 }
78
79 return $retval;
80 }
81
82}
$line
Definition cdb.php:59
A pseudo-formatter that just passes along the Diff::$edits array.
Base class for diff formatters.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account incomplete not yet checked for validity & $retval
Definition hooks.txt:266