public function isEqual($v, $aa, $bb)
 {
     if ($this->flags->ignore_whitespace) {
         return coopy_TableDiff_0($this, $aa, $bb, $v) === coopy_TableDiff_1($this, $aa, $bb, $v);
     }
     return $v->equals($aa, $bb);
 }
Example #2
0
 public function scanRow($unit, $output, $at, $i)
 {
     $_g1 = 0;
     $_g = $this->column_units->length;
     while ($_g1 < $_g) {
         $j = $_g1++;
         $cunit = $this->column_units[$j];
         $pp = null;
         $ll = null;
         $rr = null;
         $dd = null;
         $dd_to = null;
         $have_dd_to = false;
         $dd_to_alt = null;
         $have_dd_to_alt = false;
         $have_pp = false;
         $have_ll = false;
         $have_rr = false;
         if ($cunit->p >= 0 && $unit->p >= 0) {
             $pp = $this->p->getCell($cunit->p, $unit->p);
             $have_pp = true;
         }
         if ($cunit->l >= 0 && $unit->l >= 0) {
             $ll = $this->a->getCell($cunit->l, $unit->l);
             $have_ll = true;
         }
         if ($cunit->r >= 0 && $unit->r >= 0) {
             $rr = $this->b->getCell($cunit->r, $unit->r);
             $have_rr = true;
             if (coopy_TableDiff_0($this, $_g, $_g1, $at, $cunit, $dd, $dd_to, $dd_to_alt, $have_dd_to, $have_dd_to_alt, $have_ll, $have_pp, $have_rr, $i, $j, $ll, $output, $pp, $rr, $unit) < 0) {
                 if ($rr !== null) {
                     if ($this->v->toString($rr) !== "") {
                         if ($this->flags->allowUpdate()) {
                             $this->have_addition = true;
                         }
                     }
                 }
             }
         }
         if ($this->nested) {
             $ndiff = $this->checkNesting($this->v, $have_ll, $ll, $have_rr, $rr, $have_pp, $pp, $i, $j);
             $ll = $ndiff[0];
             $rr = $ndiff[1];
             $pp = $ndiff[2];
             unset($ndiff);
         }
         if ($have_pp) {
             if (!$have_rr) {
                 $dd = $pp;
             } else {
                 if ($this->isEqual($this->v, $pp, $rr)) {
                     $dd = $ll;
                 } else {
                     $dd = $pp;
                     $dd_to = $rr;
                     $have_dd_to = true;
                     if (!$this->isEqual($this->v, $pp, $ll)) {
                         if (!$this->isEqual($this->v, $pp, $rr)) {
                             $dd_to_alt = $ll;
                             $have_dd_to_alt = true;
                         }
                     }
                 }
             }
         } else {
             if ($have_ll) {
                 if (!$have_rr) {
                     $dd = $ll;
                 } else {
                     if ($this->isEqual($this->v, $ll, $rr)) {
                         $dd = $ll;
                     } else {
                         $dd = $ll;
                         $dd_to = $rr;
                         $have_dd_to = true;
                     }
                 }
             } else {
                 $dd = $rr;
             }
         }
         $cell = $dd;
         if ($have_dd_to && $this->allow_update) {
             if ($this->active_column !== null) {
                 $this->active_column[$j] = 1;
             }
             if ($this->sep === "") {
                 if ($this->builder->needSeparator()) {
                     $this->sep = $this->getSeparator($this->a, $this->b, "->");
                     $this->builder->setSeparator($this->sep);
                 } else {
                     $this->sep = "->";
                 }
             }
             $is_conflict = false;
             if ($have_dd_to_alt) {
                 if (!$this->isEqual($this->v, $dd_to, $dd_to_alt)) {
                     $is_conflict = true;
                 }
             }
             if (!$is_conflict) {
                 $cell = $this->builder->update($dd, $dd_to);
                 if (strlen($this->sep) > strlen($this->act)) {
                     $this->act = $this->sep;
                 }
             } else {
                 if ($this->conflict_sep === "") {
                     if ($this->builder->needSeparator()) {
                         $this->conflict_sep = _hx_string_or_null($this->getSeparator($this->p, $this->a, "!")) . _hx_string_or_null($this->sep);
                         $this->builder->setConflictSeparator($this->conflict_sep);
                     } else {
                         $this->conflict_sep = "!->";
                     }
                 }
                 $cell = $this->builder->conflict($dd, $dd_to_alt, $dd_to);
                 $this->act = $this->conflict_sep;
             }
             unset($is_conflict);
         }
         if ($this->act === "" && $this->have_addition) {
             $this->act = "+";
         }
         if ($this->act === "+++") {
             if ($have_rr) {
                 if ($this->active_column !== null) {
                     $this->active_column[$j] = 1;
                 }
             }
         }
         if ($this->publish) {
             if ($this->active_column === null || $this->active_column->a[$j] > 0) {
                 $output->setCell($j + 1, $at, $cell);
             }
         }
         unset($rr, $pp, $ll, $j, $have_rr, $have_pp, $have_ll, $have_dd_to_alt, $have_dd_to, $dd_to_alt, $dd_to, $dd, $cunit, $cell);
     }
     if ($this->publish) {
         $output->setCell(0, $at, $this->builder->marker($this->act));
         $this->row_map->set($at, $unit);
     }
     if ($this->act !== "") {
         $this->diff_found = true;
         if (!$this->publish) {
             if ($this->active_row !== null) {
                 $this->active_row[$i] = 1;
             }
         }
     }
 }