[ Index ]

PHP Cross Reference of MyBB

title

Body

[close]

/inc/3rdparty/diff/Diff/ThreeWay/ -> BlockBuilder.php (source)

   1  <?php
   2  /**
   3   * Copyright 2007-2011 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
  13  if(!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  
  18  class Horde_Text_Diff_ThreeWay_BlockBuilder
  19  {
  20      public function __construct()
  21      {
  22          $this->_init();
  23      }
  24  
  25      public function input($lines)
  26      {
  27          if ($lines) {
  28              $this->_append($this->orig, $lines);
  29          }
  30      }
  31  
  32      public function out1($lines)
  33      {
  34          if ($lines) {
  35              $this->_append($this->final1, $lines);
  36          }
  37      }
  38  
  39      public function out2($lines)
  40      {
  41          if ($lines) {
  42              $this->_append($this->final2, $lines);
  43          }
  44      }
  45  
  46      public function isEmpty()
  47      {
  48          return !$this->orig && !$this->final1 && !$this->final2;
  49      }
  50  
  51      public function finish()
  52      {
  53          if ($this->isEmpty()) {
  54              return false;
  55          } else {
  56              $edit = new Horde_Text_Diff_ThreeWay_Op_Base($this->orig, $this->final1, $this->final2);
  57              $this->_init();
  58              return $edit;
  59          }
  60      }
  61  
  62      protected function _init()
  63      {
  64          $this->orig = $this->final1 = $this->final2 = array();
  65      }
  66  
  67      protected function _append(&$array, $lines)
  68      {
  69          array_splice($array, sizeof($array), 0, $lines);
  70      }
  71  }


Generated: Tue Oct 8 19:19:50 2013 Cross-referenced by PHPXref 0.7.1