Version 3.0.5

This commit is contained in:
Neo committed 2025-12-19 00:31:03 -08:00
1 parent 19b38c7c74
commit 1d4720f3e2
3755 files changed
+508378 -664541

No files matched your search

+29 -12
View File
@@ -1,12 +1,24 @@
<?php
/**
* A class for computing three way diffs.
*
* $Horde: framework/Text_Diff/Diff3.php,v 1.2.10.6 2008/01/04 10:37:26 jan Exp $
*
* Copyright 2007-2008 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you did
* not receive this file, see http://opensource.org/licenses/lgpl-license.php.
*
* @package Text_Diff
* @since 0.3.0
*/
/** Text_Diff */
require_once 'Text/Diff.php';
/**
* A class for computing three way diffs.
*
* $Horde: framework/Text_Diff/Diff3.php,v 1.2 2004/10/13 09:30:20 jan Exp $
*
* @package Text_Diff
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
*/
@@ -15,7 +27,7 @@ class Text_Diff3 extends Text_Diff {
/**
* Conflict counter.
*
* @var integer $_conflictCounter
* @var integer
*/
var $_conflictingBlocks = 0;
@@ -29,15 +41,17 @@ class Text_Diff3 extends Text_Diff {
function Text_Diff3($orig, $final1, $final2)
{
if (extension_loaded('xdiff')) {
$engine = &new Text_Diff_Engine_xdiff();
$engine = new Text_Diff_Engine_xdiff();
} else {
$engine = &new Text_Diff_Engine_native();
$engine = new Text_Diff_Engine_native();
}
$this->_edits = $this->_diff3($engine->diff($orig, $final1),
$engine->diff($orig, $final2));
}
/**
*/
function mergedOutput($label1 = false, $label2 = false)
{
$lines = array();
@@ -65,7 +79,7 @@ class Text_Diff3 extends Text_Diff {
function _diff3($edits1, $edits2)
{
$edits = array();
$bb = &new Text_Diff3_BlockBuilder();
$bb = new Text_Diff3_BlockBuilder();
$e1 = current($edits1);
$e2 = current($edits2);
@@ -80,7 +94,7 @@ class Text_Diff3 extends Text_Diff {
$ncopy = min($e1->norig(), $e2->norig());
assert($ncopy > 0);
$edits[] = &new Text_Diff3_Op_copy(array_slice($e1->orig, 0, $ncopy));
$edits[] = new Text_Diff3_Op_copy(array_slice($e1->orig, 0, $ncopy));
if ($e1->norig() > $ncopy) {
array_splice($e1->orig, 0, $ncopy);
@@ -136,7 +150,8 @@ class Text_Diff3 extends Text_Diff {
/**
* @package Text_Diff
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
* @access private
*
* @access private
*/
class Text_Diff3_Op {
@@ -174,7 +189,8 @@ class Text_Diff3_Op {
/**
* @package Text_Diff
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
* @access private
*
* @access private
*/
class Text_Diff3_Op_copy extends Text_Diff3_Op {
@@ -200,7 +216,8 @@ class Text_Diff3_Op_copy extends Text_Diff3_Op {
/**
* @package Text_Diff
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
* @access private
*
* @access private
*/
class Text_Diff3_BlockBuilder {
@@ -240,7 +257,7 @@ class Text_Diff3_BlockBuilder {
if ($this->isEmpty()) {
return false;
} else {
$edit = &new Text_Diff3_Op($this->orig, $this->final1, $this->final2);
$edit = new Text_Diff3_Op($this->orig, $this->final1, $this->final2);
$this->_init();
return $edit;
}
@@ -256,4 +273,4 @@ class Text_Diff3_BlockBuilder {
array_splice($array, sizeof($array), 0, $lines);
}
}
}