src/Evaluators/HighHandEvaluator.php
/**
    * Group and sort the cards according to their suits
    * Group the cards in to suits.
    * Sort all suits by the count of cards in each suit.
    * Sort cards in each suit according to their value.
    * This is so if there is a suit with 5 cards, then a flush exists
    * and we want the flush sorted according to their value so we know the highest flush value
    * 
    * @return void
    */
Group and sort the cards according to their suits
Group the cards in to suits.
Sort all suits by the count of cards in each suit.
Sort cards in each suit according to their value.
This is so if there is a suit with 5 cards, then a flush exists
and we want the flush sorted according to their value so we know the highest flush value

@return void
Group and sort the cards according to their suits Group the cards in to suits . Sort all suits by the count of cards in each suit . Sort cards in each suit according to their value . This is so if there is a suit with 5 cards then a flush exists and we want the flush sorted according to their value so we know the highest flush value @return void
protected function generateSuitHistogram(): Void
    {
        $suits = [];
        foreach ($this->cards as $card) {
            $suits[$card->getSuitRank()][] = $card;
        }
        uasort($suits, fn($suit1, $suit2) => count($suit2) <=> count($suit1));
        foreach($suits as $index => $suit) {
            $sortedValues = $suit;
            usort($sortedValues, fn($card1, $card2) => $card2->getValueRank() <=> $card1->getValueRank());
            $suits[$index] = $sortedValues;
        }
        $this->suitHistogram = $suits;
    }
protected function generateSuitHistogram ( ) : Void { $ suits = [ ] ; foreach ( $ this -> cards as $ card ) { $ suits [ $ card -> getSuitRank ( ) ] [ ] = $ card ; } uasort ( $ suits , fn ( $ suit1 , $ suit2 ) => count ( $ suit2 ) <=> count ( $ suit1 ) ) ; foreach ( $ suits as $ index => $ suit ) { $ sortedValues = $ suit ; usort ( $ sortedValues , fn ( $ card1 , $ card2 ) => $ card2 -> getValueRank ( ) <=> $ card1 -> getValueRank ( ) ) ; $ suits [ $ index ] = $ sortedValues ; } $ this -> suitHistogram = $ suits ; }
Group and sort the cards according to their suits
 Group the cards in to suits.
Group and sort the cards according to their suits Group the cards in to suits .
// Group all cards in to suits // Sort suits by count of cards in each suits. // uasort is user defined sorting function which maintains keys which are numerical value of suit // Sort cards of each suit according to their value rank highest first // Create copy of array to sort // Replace suit array with sortedArray at index