diff options
Diffstat (limited to 'inc/DifferenceEngine.php')
-rw-r--r-- | inc/DifferenceEngine.php | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php index 906a17b2d..2578d07ee 100644 --- a/inc/DifferenceEngine.php +++ b/inc/DifferenceEngine.php @@ -29,8 +29,8 @@ class _DiffOp { class _DiffOp_Copy extends _DiffOp { var $type = 'copy'; - - function _DiffOp_Copy($orig, $closing = false) { + + function __construct($orig, $closing = false) { if (!is_array($closing)) $closing = $orig; $this->orig = $orig; @@ -44,8 +44,8 @@ class _DiffOp_Copy extends _DiffOp { class _DiffOp_Delete extends _DiffOp { var $type = 'delete'; - - function _DiffOp_Delete($lines) { + + function __construct($lines) { $this->orig = $lines; $this->closing = false; } @@ -57,8 +57,8 @@ class _DiffOp_Delete extends _DiffOp { class _DiffOp_Add extends _DiffOp { var $type = 'add'; - - function _DiffOp_Add($lines) { + + function __construct($lines) { $this->closing = $lines; $this->orig = false; } @@ -70,8 +70,8 @@ class _DiffOp_Add extends _DiffOp { class _DiffOp_Change extends _DiffOp { var $type = 'change'; - - function _DiffOp_Change($orig, $closing) { + + function __construct($orig, $closing) { $this->orig = $orig; $this->closing = $closing; } @@ -499,7 +499,7 @@ class Diff { * (Typically these are lines from a file.) * @param $to_lines array An array of strings. */ - function Diff($from_lines, $to_lines) { + function __construct($from_lines, $to_lines) { $eng = new _DiffEngine; $this->edits = $eng->diff($from_lines, $to_lines); //$this->_check($from_lines, $to_lines); @@ -645,12 +645,12 @@ class MappedDiff extends Diff { * @param $mapped_to_lines array This array should * have the same number of elements as $to_lines. */ - function MappedDiff($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines) { + function __construct($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines) { assert(count($from_lines) == count($mapped_from_lines)); assert(count($to_lines) == count($mapped_to_lines)); - $this->Diff($mapped_from_lines, $mapped_to_lines); + parent::__construct($mapped_from_lines, $mapped_to_lines); $xi = $yi = 0; $ecnt = count($this->edits); @@ -827,7 +827,8 @@ class DiffFormatter { define('NBSP', "\xC2\xA0"); // utf-8 non-breaking space. class _HWLDF_WordAccumulator { - function _HWLDF_WordAccumulator() { + + function __construct() { $this->_lines = array(); $this->_line = ''; $this->_group = ''; @@ -882,11 +883,11 @@ class _HWLDF_WordAccumulator { class WordLevelDiff extends MappedDiff { - function WordLevelDiff($orig_lines, $closing_lines) { + function __construct($orig_lines, $closing_lines) { list ($orig_words, $orig_stripped) = $this->_split($orig_lines); list ($closing_words, $closing_stripped) = $this->_split($closing_lines); - $this->MappedDiff($orig_words, $closing_words, $orig_stripped, $closing_stripped); + parent::__construct($orig_words, $closing_words, $orig_stripped, $closing_stripped); } function _split($lines) { @@ -923,12 +924,12 @@ class WordLevelDiff extends MappedDiff { } class InlineWordLevelDiff extends MappedDiff { - - function InlineWordLevelDiff($orig_lines, $closing_lines) { + + function __construct($orig_lines, $closing_lines) { list ($orig_words, $orig_stripped) = $this->_split($orig_lines); list ($closing_words, $closing_stripped) = $this->_split($closing_lines); - $this->MappedDiff($orig_words, $closing_words, $orig_stripped, $closing_stripped); + parent::__construct($orig_words, $closing_words, $orig_stripped, $closing_stripped); } function _split($lines) { @@ -965,7 +966,7 @@ class InlineWordLevelDiff extends MappedDiff { */ class UnifiedDiffFormatter extends DiffFormatter { - function UnifiedDiffFormatter($context_lines = 4) { + function __construct($context_lines = 4) { $this->leading_context_lines = $context_lines; $this->trailing_context_lines = $context_lines; } @@ -996,7 +997,7 @@ class UnifiedDiffFormatter extends DiffFormatter { */ class TableDiffFormatter extends DiffFormatter { - function TableDiffFormatter() { + function __construct() { $this->leading_context_lines = 2; $this->trailing_context_lines = 2; } @@ -1089,7 +1090,7 @@ class TableDiffFormatter extends DiffFormatter { class InlineDiffFormatter extends DiffFormatter { var $colspan = 4; - function InlineDiffFormatter() { + function __construct() { $this->leading_context_lines = 2; $this->trailing_context_lines = 2; } |