You are here

private function Differ::selectLcsImplementation in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/sebastian/diff/src/Differ.php \SebastianBergmann\Diff\Differ::selectLcsImplementation()

Parameters

array $from:

array $to:

Return value

LongestCommonSubsequence

1 call to Differ::selectLcsImplementation()
Differ::diffToArray in vendor/sebastian/diff/src/Differ.php
Returns the diff between two arrays or strings as array.

File

vendor/sebastian/diff/src/Differ.php, line 228

Class

Differ
Diff implementation.

Namespace

SebastianBergmann\Diff

Code

private function selectLcsImplementation(array $from, array $to) {

  // We do not want to use the time-efficient implementation if its memory
  // footprint will probably exceed this value. Note that the footprint
  // calculation is only an estimation for the matrix and the LCS method
  // will typically allocate a bit more memory than this.
  $memoryLimit = 100 * 1024 * 1024;
  if ($this
    ->calculateEstimatedFootprint($from, $to) > $memoryLimit) {
    return new MemoryEfficientImplementation();
  }
  return new TimeEfficientImplementation();
}