src/LevenshteinDistance.php
private function mergeNeighborProgresses(array $progresses): array
    {
        $progressesCount = \count($progresses);

        if ($progressesCount === 0) {
            return [];
        }

        $merged = [];
        $last = $progresses[0];

        for ($step = 1; $step < $progressesCount; ++$step) {
            $progress = $progresses[$step];

            if ($last[0] === $progress[0]) {
                $progress[3] += $last[3];
            } else {
                $merged[] = $last;
            }

            $last = $progress;
        }

        $merged[] = $last;

        return $merged;
    }
private function mergeNeighborProgresses(array $progresses): array
    {
        $progressesCount = \count($progresses);

        if ($progressesCount === 0) {
            return [];
        }

        $merged = [];
        $last = $progresses[0];

        for ($step = 1; $step < $progressesCount; ++$step) {
            $progress = $progresses[$step];

            if ($last[0] === $progress[0]) {
                $progress[3] += $last[3];
            } else {
                $merged[] = $last;
            }

            $last = $progress;
        }

        $merged[] = $last;

        return $merged;
    }
private function mergeNeighborProgresses ( array $ progresses ) : array { $ progressesCount = \ count ( $ progresses ) ; if ( $ progressesCount === 0 ) { return [ ] ; } $ merged = [ ] ; $ last = $ progresses [ 0 ] ; for ( $ step = 1 ; $ step < $ progressesCount ; ++ $ step ) { $ progress = $ progresses [ $ step ] ; if ( $ last [ 0 ] === $ progress [ 0 ] ) { $ progress [ 3 ] += $ last [ 3 ] ; } else { $ merged [ ] = $ last ; } $ last = $ progress ; } $ merged [ ] = $ last ; return $ merged ; }
Merge neighbor progresses and return the merged result.

@param array $progresses the progresses

@return array
Merge neighbor progresses and return the merged result .