Lines Matching refs:new
31 * @param T[] $new New array
35 public function diff(array $old, array $new): array { argument
37 $new = \array_values($new);
38 list($trace, $x, $y) = $this->calculateTrace($old, $new);
39 return $this->extractDiff($trace, $x, $y, $old, $new);
49 * @param T[] $new New array
53 public function diffWithReplacements(array $old, array $new): array { argument
54 return $this->coalesceReplacements($this->diff($old, $new));
59 * @param T[] $new
62 private function calculateTrace(array $old, array $new): array { argument
64 $m = \count($new);
78 while ($x < $n && $y < $m && ($this->isEqual)($old[$x], $new[$y])) {
95 * @param T[] $new
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]);
129 $result[] = new DiffElem(DiffElem::TYPE_ADD, null, $new[$y - 1]);