DiffMatchPatch\Diff::bisectSplit PHP Method

bisectSplit() protected method

Given the location of the 'middle snake', split the diff in two parts and recurse.
protected bisectSplit ( string $text1, string $text2, integer $x, integer $y, integer $deadline ) : array
$text1 string Old string to be diffed.
$text2 string New string to be diffed.
$x integer Index of split point in text1.
$y integer Index of split point in text2.
$deadline integer Time at which to bail if not yet complete.
return array Array of diff arrays.
    protected function bisectSplit($text1, $text2, $x, $y, $deadline)
    {
        $text1A = mb_substr($text1, 0, $x);
        $text2A = mb_substr($text2, 0, $y);
        $text1B = mb_substr($text1, $x);
        $text2B = mb_substr($text2, $y);
        // Compute both diffs serially.
        $diffA = new Diff();
        $diffA->main($text1A, $text2A, false, $deadline);
        $diffB = new Diff();
        $diffB->main($text1B, $text2B, false, $deadline);
        return array_merge($diffA->getChanges(), $diffB->getChanges());
    }