1: <?php
2: /**
3: * Copyright 2007-2012 Horde LLC (http://www.horde.org/)
4: *
5: * See the enclosed file COPYING for license information (LGPL). If you did
6: * not receive this file, see http://www.horde.org/licenses/lgpl21.
7: *
8: * @package Text_Diff
9: * @author Geoffrey T. Dairiki <dairiki@dairiki.org>
10: */
11: class Horde_Text_Diff_ThreeWay_Op_Base
12: {
13: public function __construct($orig = false, $final1 = false, $final2 = false)
14: {
15: $this->orig = $orig ? $orig : array();
16: $this->final1 = $final1 ? $final1 : array();
17: $this->final2 = $final2 ? $final2 : array();
18: }
19:
20: public function merged()
21: {
22: if (!isset($this->_merged)) {
23: if ($this->final1 === $this->final2) {
24: $this->_merged = &$this->final1;
25: } elseif ($this->final1 === $this->orig) {
26: $this->_merged = &$this->final2;
27: } elseif ($this->final2 === $this->orig) {
28: $this->_merged = &$this->final1;
29: } else {
30: $this->_merged = false;
31: }
32: }
33:
34: return $this->_merged;
35: }
36:
37: public function isConflict()
38: {
39: return $this->merged() === false;
40: }
41: }
42: