Example #1
0
 public function testHandStrengthFlush()
 {
     $handStrength = new HandStrength([new Card('Spade', 2), new Card('Spade', 10), new Card('Spade', 12), new Card('Spade', 5), new Card('Spade', 9), new Card('Spade', 7), new Card('Spade', 8)]);
     $this->assertEquals('Flush', $handStrength->getDescription());
 }
Example #2
0
 public function isStraightFlush()
 {
     if ($this->isFlush()) {
         $flushCards = [];
         foreach ($this->cards as $card) {
             if ($card->getSuit() == $this->flushSuit) {
                 $flushCards[] = clone $card;
             }
         }
         $handStrength = new HandStrength($flushCards);
         $handStrength->sortCards();
         if ($handStrength->isStraight()) {
             $this->highEnd = $handStrength->getHighEnd();
             return true;
         }
     }
     return false;
 }