Lines Matching refs:old
30 * @param T[] $old Original array
35 public function diff(array $old, array $new): array { argument
36 $old = \array_values($old);
38 list($trace, $x, $y) = $this->calculateTrace($old, $new);
39 return $this->extractDiff($trace, $x, $y, $old, $new);
48 * @param T[] $old Original array
53 public function diffWithReplacements(array $old, array $new): array { argument
54 return $this->coalesceReplacements($this->diff($old, $new));
58 * @param T[] $old
62 private function calculateTrace(array $old, array $new): array { argument
63 $n = \count($old);
78 while ($x < $n && $y < $m && ($this->isEqual)($old[$x], $new[$y])) {
94 * @param T[] $old
98 private function extractDiff(array $trace, int $x, int $y, array $old, array $new): array { argument
114 $result[] = new DiffElem(DiffElem::TYPE_KEEP, $old[$x - 1], $new[$y - 1]);
124 $result[] = new DiffElem(DiffElem::TYPE_REMOVE, $old[$x - 1], null);
166 DiffElem::TYPE_REPLACE, $diff[$i + $n]->old, $diff[$j + $n]->new