src/Finder.php
protected function sortHaystack()
    {
        $sorted_haystack = [];
        foreach ($this->haystack as $string) {
            $sorted_haystack[$string] = $this->levenshteinUtf8($this->needle, $string);
        }

        // Apply threshold when set.
        if(!is_null($this->threshold)){
            $sorted_haystack = array_filter($sorted_haystack, function ($score){
                return $score <= $this->threshold;
            });
        }

        asort($sorted_haystack);

        $this->sorted_haystack = $sorted_haystack;
    }
protected function sortHaystack()
    {
        $sorted_haystack = [];
        foreach ($this->haystack as $string) {
            $sorted_haystack[$string] = $this->levenshteinUtf8($this->needle, $string);
        }

        // Apply threshold when set.
        if(!is_null($this->threshold)){
            $sorted_haystack = array_filter($sorted_haystack, function ($score){
                return $score <= $this->threshold;
            });
        }

        asort($sorted_haystack);

        $this->sorted_haystack = $sorted_haystack;
    }
protected function sortHaystack ( ) { $ sorted_haystack = [ ] ; foreach ( $ this -> haystack as $ string ) { $ sorted_haystack [ $ string ] = $ this -> levenshteinUtf8 ( $ this -> needle , $ string ) ; } // Apply threshold when set. if ( ! is_null ( $ this -> threshold ) ) { $ sorted_haystack = array_filter ( $ sorted_haystack , function ( $ score ) { return $ score <= $ this -> threshold ; } ) ; } asort ( $ sorted_haystack ) ; $ this -> sorted_haystack = $ sorted_haystack ; }
Sort Haystack.

@return void
Sort Haystack .