src/Console/Corrector.php
public static function match(string $input, array $possibleTokens = []): string
    {
        if (empty($possibleTokens)) {
            return $input;
        }

        $bestSimilarity = -1;
        $bestGuess = $input;
        foreach ($possibleTokens as $possibleToken) {
            similar_text($input, $possibleToken, $similarity);
            if ($similarity > $bestSimilarity) {
                $bestSimilarity = $similarity;
                $bestGuess = $possibleToken;
            }
        }

        return $bestGuess;
    }
public static function match(string $input, array $possibleTokens = []): string
    {
        if (empty($possibleTokens)) {
            return $input;
        }

        $bestSimilarity = -1;
        $bestGuess = $input;
        foreach ($possibleTokens as $possibleToken) {
            similar_text($input, $possibleToken, $similarity);
            if ($similarity > $bestSimilarity) {
                $bestSimilarity = $similarity;
                $bestGuess = $possibleToken;
            }
        }

        return $bestGuess;
    }
public static function match ( string $ input , array $ possibleTokens = [ ] ) : string { if ( empty ( $ possibleTokens ) ) { return $ input ; } $ bestSimilarity = - 1 ; $ bestGuess = $ input ; foreach ( $ possibleTokens as $ possibleToken ) { similar_text ( $ input , $ possibleToken , $ similarity ) ; if ( $ similarity > $ bestSimilarity ) { $ bestSimilarity = $ similarity ; $ bestGuess = $ possibleToken ; } } return $ bestGuess ; }
Given user's input, return the best match among candidates.

@param string   $input          @see self::correct()
@param string[] $possibleTokens @see self::correct()

@return string best matched string or raw input if no candidates provided
Given user s input return the best match among candidates .