@param CardCollection $cards

@return bool|CardCollection
969647
public static function fullHouse(CardCollection $cards)
    {
        $threeOfAKind = self::nNumberOfCardsInSet($cards, 3);
        $twoOfAKind = self::nNumberOfCardsInSet($cards->diff($threeOfAKind), 2);

        if ($threeOfAKind === null || $twoOfAKind === null) {
            return false;
        }

        return $threeOfAKind->merge($twoOfAKind);
    }
385736
public function addManagedCollections($collections)
    {
        if (!is_array($collections)) {
            $collections = array($collections);
        }
        $this->managedCollections = array_merge($this->managedCollections, $collections);

        return $this;
    }
955946
private function linkCards(array $cards)
    {
        /** @var Card[] $linkedCards */
        $linkedCards = [];
        foreach ($cards as $card) {
            foreach ($cards as $previousCard) {
                if ($card->getPreviousCardId() == $previousCard->getID()) {
                    $linkedCards[] = new Card(
                        $card->getID(),
                        $card->getIdentity(),
                        $card->getPublicKey(),
                        $card->getVersion(),
                        $card->getCreatedAt(),
                        $card->isOutdated(),
                        $card->getSignatures(),
                        $card->getContentSnapshot(),
                        $card->getPreviousCardId(),
                        new Card(
                            $previousCard->getID(),
                            $previousCard->getIdentity(),
                            $previousCard->getPublicKey(),
                            $previousCard->getVersion(),
                            $previousCard->getCreatedAt(),
                            true,
                            $previousCard->getSignatures(),
                            $previousCard->getContentSnapshot()
                        )
                    );
                }
            }
        }

        foreach ($cards as $card) {
            $isCardAdded = false;
            foreach ($linkedCards as $linkedCard) {
                if ($linkedCard->getID() == $card->getID()) {
                    $isCardAdded = true;
                }

                $previousCard = $linkedCard->getPreviousCard();
                if ($previousCard != null && $previousCard->getID() == $card->getID()) {
                    $isCardAdded = true;
                }
            }
            if (!$isCardAdded) {
                $linkedCards[] = $card;
            }
        }

        return $linkedCards;
    }
694742
public static function royalFlush(CardCollection $cards)
    {
        // check for straight flush
        if (!static::straightFlush($cards)) {
            return false;
        }

        // make sure that TJQKA exist in hand
        $royalFlushHand = $cards
            ->switchAceValue()
            ->filter(function (Card $card) {
                return $card->isFaceCard() || $card->value() === 10;
            });

        if ($royalFlushHand->count() < 5) {
            return false;
        }

        return $royalFlushHand->sortByValue();
    }
730520
public static function createFullHouse(CardCollection $cards, Hand $hand): self
    {
        $cardGroups = $cards->groupByValue()->take(2);

        $firstCardGroup = $cardGroups->first()->first();
        $lastCardGroup = $cardGroups->last()->first();
        $definition = sprintf(
            'Full House - %ss over %ss',
            $firstCardGroup->name(),
            $lastCardGroup->name()
        );

        return new static(
            self::FULL_HOUSE,
            [$firstCardGroup->value(), $lastCardGroup->value()],
            $cards,
            $definition,
            $hand
        );
    }
1027820
public function getCollection($collectionId, $fields = ['*'])
    {
        $apiUrl = $this->getEndpoint('collections');
        $apiUrl .= $collectionId;

        $params = array(
            'fields' => implode(',', $fields)
        );

        $apiData = $this->apiGet($apiUrl, $params);

        return $this->decodeSingle($apiData);
    }
988327
public static function fromString(string $cards)
    {
        $cards = explode(' ', $cards);

        return static::make($cards)->map(function ($card) {
            return Card::fromString($card);
        });
    }
754475
public static function createHighCard(CardCollection $cards, Hand $hand): self
    {
        $cardValues = $cards->sortByValue()->values();

        $highCard = $cardValues->get(4);

        $definition = sprintf('High Card - %s', $highCard->name());

        return new static(
            self::HIGH_CARD,
            $cardValues->map(function (Card $card) {
                return $card->value();
            })->toArray(),
            $cards,
            $definition,
            $hand
        );
    }
568070
public static function fourOfAKind(CardCollection $cards)
    {
        $judgedHand = self::nNumberOfCardsInSet($cards, 4);

        if ($judgedHand === null) {
            return false;
        }

        $highCard = self::highCard($cards->diff($judgedHand))->last();

        return $judgedHand
            ->push($highCard)
            ->switchAceValue()
            ->sortByValue();
    }
1173350
public static function make($items)
    {
        if (is_null($items)) {
            return new static;
        }

        if ($items instanceof Collection) {
            return $items;
        }

        return new static(is_array($items) ? $items : [$items]);
    }
762253
public function getBatchCards($offset = 0, $count = 50)
    {
        $result = $this->httpPost(static::WECHAT_GET_BATCH_CARD_URL . 'access_token=' . $this->getAccessToken(), [
            'offset' => $offset,
            'count' => $count
        ]);

        return isset($result['card_id_list']) ? $result['card_id_list'] : false;
    }
964951
public function getCard($cardID)
    {
        $tokenContext = new TokenContext("", 'get');
        $token = $this->accessTokenProvider->getToken($tokenContext);

        $responseModel = $this->cardClient->getCard($cardID, (string)$token);
        if ($responseModel instanceof ErrorResponseModel) {
            throw new CardClientException(
                "error response from card service", $responseModel->getCode(), $responseModel->getMessage()
            );
        }

        $card = $this->parseRawCard($responseModel->getRawSignedModel(), $responseModel->isOutdated());

        if (!$this->cardVerifier->verifyCard($card)) {
            throw new CardVerificationException('Validation errors have been detected');
        }

        return $card;
    }
249805
public static function createStraight(CardCollection $cards, Hand $hand): self
    {
        $highCard = $cards->sortByValue()->take(-1);
        $definition = sprintf('Straight to %s', $highCard->first()->name());

        return new static(
            self::STRAIGHT,
            [$highCard->first()->value()],
            $cards,
            $definition,
            $hand
        );
    }
667912
public static function isMonthValid($card)
	{
		$isValid = false;

		if(isset($card['expiryMonth'])) {

			$isExpiryMonthEmpty = CheckoutApi_Lib_Validator::isEmpty($card['expiryMonth'],false);
			
			if(!$isExpiryMonthEmpty && CheckoutApi_Lib_Validator::isInteger($card['expiryMonth']) && ($card['expiryMonth']  > 0 && $card['expiryMonth'] < 13)) {
				$isValid = true;
			} 
		} 

		return $isValid;
	}
290038
public function addManyToManyCollections($collections)
    {
        if (!is_array($collections)) {
            $collections = [$collections];
        }
        $this->manyToManyCollections = array_merge($this->manyToManyCollections, $collections);

        return $this;
    }
1138908
public static function createStraightFlush(CardCollection $cards, Hand $hand): self
    {
        $highCard = $cards->sortByValue()->take(-1);
        $definition = sprintf('Straight Flush to %s', $highCard->first()->name());

        return new static(
            self::STRAIGHT_FLUSH,
            [$highCard->first()->value()],
            $cards,
            $definition,
            $hand
        );
    }
1071422
final function cardsActive($c) {return array_filter($this->cards($c), function(Card $card) {return
		$card->isActive()
	;});}