src/Deck.php
/**
    * Take a card from the top of the deck if null
    * or
    * Take a specific card from anywhere in the deck if found
    * 
    * @param Card|null $card
    * @return Card
    */
Take a card from the top of the deck if null
or
Take a specific card from anywhere in the deck if found

@param Card|null $card
@return Card
Take a card from the top of the deck if null or Take a specific card from anywhere in the deck if found @param Card|null $card @return Card
public function takeCard(Card $card = null): Card
    {
        if (is_null($card)) {
            return array_shift($this->cards);
        } else {
            $findCard = array_search($card, $this->cards);
            if ($findCard !== false) {
                $card = $this->cards[$findCard];
                array_splice($this->cards, $findCard, 1);
                return $card;
            } else {
                $cardDescription = $card->getDescription();
                throw new InvalidDeckOperationException("$cardDescription not found in deck");
            }
        }
    }
public function takeCard ( Card $ card = null ) : Card { if ( is_null ( $ card ) ) { return array_shift ( $ this -> cards ) ; } else { $ findCard = array_search ( $ card , $ this -> cards ) ; if ( $ findCard !== false ) { $ card = $ this -> cards [ $ findCard ] ; array_splice ( $ this -> cards , $ findCard , 1 ) ; return $ card ; } else { $ cardDescription = $ card -> getDescription ( ) ; throw new InvalidDeckOperationException ( " $ cardDescription  not found in deck " ) ; } } }
Take a card from the top of the deck if null
 or
 Take a specific card from anywhere in the deck if found
Take a card from the top of the deck if null or Take a specific card from anywhere in the deck if found