Skip to content

Commit a62ff4d

Browse files
Refactor
1 parent 26b502a commit a62ff4d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Differ.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ public function diff($from, $to, LongestCommonSubsequence $lcs = null)
157157
public function diffToArray($from, $to, LongestCommonSubsequence $lcs = null)
158158
{
159159
if ($lcs === null) {
160-
// @todo Automagically choose best strategy based on input size
161-
$lcs = new TimeEfficientImplementation;
160+
$lcs = $this->selectLcsImplementation($from, $to);
162161
}
163162

164163
preg_match_all('(\r\n|\r|\n)', $from, $fromMatches);
@@ -245,4 +244,15 @@ public function diffToArray($from, $to, LongestCommonSubsequence $lcs = null)
245244

246245
return $diff;
247246
}
247+
248+
/**
249+
* @param array|string $from
250+
* @param array|string $to
251+
* @return LongestCommonSubsequence
252+
*/
253+
private function selectLcsImplementation($from, $to)
254+
{
255+
// @todo Automagically choose best strategy based on input size
256+
return new TimeEfficientImplementation;
257+
}
248258
}

0 commit comments

Comments
 (0)