MediaWiki master
DiffOp.php
Go to the documentation of this file.
1<?php
14namespace Wikimedia\Diff;
15
24abstract class DiffOp {
25
30 public $type;
31
36 public $orig;
37
42 public $closing;
43
47 public function getType() {
48 return $this->type;
49 }
50
57 public function getOrig() {
58 return $this->orig;
59 }
60
70 public function getClosing( $i = null ) {
71 if ( $i === null ) {
72 return $this->closing;
73 }
74 if ( array_key_exists( $i, $this->closing ) ) {
75 return $this->closing[$i];
76 }
77 return null;
78 }
79
83 abstract public function reverse();
84
88 public function norig() {
89 return $this->orig ? count( $this->orig ) : 0;
90 }
91
95 public function nclosing() {
96 return $this->closing ? count( $this->closing ) : 0;
97 }
98}
99
101class_alias( DiffOp::class, 'DiffOp' );
The base class for all other DiffOp classes.
Definition DiffOp.php:24
getClosing( $i=null)
Without a line number this returns either all lines on the right ("new") side of the diff,...
Definition DiffOp.php:70
getOrig()
Returns either all lines on the left ("old") side of the diff, or false when it's an add operation.
Definition DiffOp.php:57
string[] false $closing
The right ("new") side of the diff, or false when it's a "delete".
Definition DiffOp.php:42
string[] false $orig
The left ("old") side of the diff, or false when it's an "add".
Definition DiffOp.php:36