1<?php
2/**
3 * Copyright 2007-2017 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
12// Disallow direct access to this file for security reasons
13if(!defined("IN_MYBB"))
14{
15	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
16}
17
18class Horde_Text_Diff_ThreeWay_Op_Base
19{
20    public function __construct($orig = false, $final1 = false, $final2 = false)
21    {
22        $this->orig = $orig ? $orig : array();
23        $this->final1 = $final1 ? $final1 : array();
24        $this->final2 = $final2 ? $final2 : array();
25    }
26
27    public function merged()
28    {
29        if (!isset($this->_merged)) {
30            if ($this->final1 === $this->final2) {
31                $this->_merged = &$this->final1;
32            } elseif ($this->final1 === $this->orig) {
33                $this->_merged = &$this->final2;
34            } elseif ($this->final2 === $this->orig) {
35                $this->_merged = &$this->final1;
36            } else {
37                $this->_merged = false;
38            }
39        }
40
41        return $this->_merged;
42    }
43
44    public function isConflict()
45    {
46        return $this->merged() === false;
47    }
48}
49