src/LevenshteinDistance.php
private function calculateRawProgresses(array $dist): array
    {
        $m = \count($dist) - 1;
        $n = \count($dist[0]) - 1;

        $progresses = $trace = [];

        for (
            $x = $m, $y = $n;
            $x !== 0 && $y !== 0;
            [$x, $y] = $trace
        ) {
            switch ($dist[$x][$y]) {
                case $dist[$x - 1][$y] + $this->costMap[self::OP_DEL]:
                    $trace = [$x - 1, $y, self::OP_DEL];
                    break;
                case $dist[$x][$y - 1] + $this->costMap[self::OP_INS]:
                    $trace = [$x, $y - 1, self::OP_INS];
                    break;
                case $dist[$x - 1][$y - 1] + $this->costMap[self::OP_REP]:
                    $trace = [$x - 1, $y - 1, self::OP_REP];
                    break;
                default:
                    $trace = [$x - 1, $y - 1, self::OP_CPY];
                    break;
            }

            $progresses[] = [$x, $y, $trace[2]];
        }

        for (; $x > 0; --$x) {
            $progresses[] = [$x, 0, self::OP_DEL];
        }

        for (; $y > 0; --$y) {
            $progresses[] = [0, $y, self::OP_INS];
        }

        return $progresses;
    }
private function calculateRawProgresses(array $dist): array
    {
        $m = \count($dist) - 1;
        $n = \count($dist[0]) - 1;

        $progresses = $trace = [];

        for (
            $x = $m, $y = $n;
            $x !== 0 && $y !== 0;
            [$x, $y] = $trace
        ) {
            switch ($dist[$x][$y]) {
                case $dist[$x - 1][$y] + $this->costMap[self::OP_DEL]:
                    $trace = [$x - 1, $y, self::OP_DEL];
                    break;
                case $dist[$x][$y - 1] + $this->costMap[self::OP_INS]:
                    $trace = [$x, $y - 1, self::OP_INS];
                    break;
                case $dist[$x - 1][$y - 1] + $this->costMap[self::OP_REP]:
                    $trace = [$x - 1, $y - 1, self::OP_REP];
                    break;
                default:
                    $trace = [$x - 1, $y - 1, self::OP_CPY];
                    break;
            }

            $progresses[] = [$x, $y, $trace[2]];
        }

        for (; $x > 0; --$x) {
            $progresses[] = [$x, 0, self::OP_DEL];
        }

        for (; $y > 0; --$y) {
            $progresses[] = [0, $y, self::OP_INS];
        }

        return $progresses;
    }
private function calculateRawProgresses ( array $ dist ) : array { $ m = \ count ( $ dist ) - 1 ; $ n = \ count ( $ dist [ 0 ] ) - 1 ; $ progresses = $ trace = [ ] ; for ( $ x = $ m , $ y = $ n ; $ x !== 0 && $ y !== 0 ; [ $ x , $ y ] = $ trace ) { switch ( $ dist [ $ x ] [ $ y ] ) { case $ dist [ $ x - 1 ] [ $ y ] + $ this -> costMap [ self :: OP_DEL ] : $ trace = [ $ x - 1 , $ y , self :: OP_DEL ] ; break ; case $ dist [ $ x ] [ $ y - 1 ] + $ this -> costMap [ self :: OP_INS ] : $ trace = [ $ x , $ y - 1 , self :: OP_INS ] ; break ; case $ dist [ $ x - 1 ] [ $ y - 1 ] + $ this -> costMap [ self :: OP_REP ] : $ trace = [ $ x - 1 , $ y - 1 , self :: OP_REP ] ; break ; default : $ trace = [ $ x - 1 , $ y - 1 , self :: OP_CPY ] ; break ; } $ progresses [ ] = [ $ x , $ y , $ trace [ 2 ] ] ; } for ( ; $ x > 0 ; -- $ x ) { $ progresses [ ] = [ $ x , 0 , self :: OP_DEL ] ; } for ( ; $ y > 0 ; -- $ y ) { $ progresses [ ] = [ 0 , $ y , self :: OP_INS ] ; } return $ progresses ; }
Calculate the raw progresses.

@param array $dist the distance array

@return array the raw progresses
Calculate the raw progresses .