Lines Matching refs:to

46      * @param array|string             $to
51 public function diff($from, $to, LongestCommonSubsequence $lcs = null) argument
54 $to = $this->validateDiffInput($to);
55 $diff = $this->diffToArray($from, $to, $lcs);
199 * @param array|string $to
204 public function diffToArray($from, $to, LongestCommonSubsequence $lcs = null) argument
215 if (\is_string($to)) {
216 $toMatches = $this->getNewLineMatches($to);
217 $to = $this->splitStringByLines($to);
218 } elseif (\is_array($to)) {
224 list($from, $to, $start, $end) = self::getArrayDiffParted($from, $to);
227 $lcs = $this->selectLcsImplementation($from, $to);
230 $common = $lcs->calculate(\array_values($from), \array_values($to));
245 \reset($to);
252 while (($toToken = \reset($to)) !== $token) {
253 $diff[] = array(\array_shift($to), 1 /* ADDED */);
259 \array_shift($to);
266 while (($token = \array_shift($to)) !== null) {
305 * @param array $to
309 private function selectLcsImplementation(array $from, array $to) argument
317 if ($this->calculateEstimatedFootprint($from, $to) > $memoryLimit) {
328 * @param array $to
332 private function calculateEstimatedFootprint(array $from, array $to) argument
336 return $itemSize * \pow(\min(\count($from), \count($to)), 2);
356 * @param array $to
360 private static function getArrayDiffParted(array &$from, array &$to) argument
365 \reset($to);
368 $toK = \key($to);
370 if ($toK === $k && $v === $to[$k]) {
373 unset($from[$k], $to[$k]);
380 \end($to);
384 $toK = \key($to);
386 if (null === $fromK || null === $toK || \current($from) !== \current($to)) {
391 \prev($to);
394 unset($from[$fromK], $to[$toK]);
397 return array($from, $to, $start, $end);