@param CardCollection $cards

@return SevenCardResult
358196
public static function createOnePair(CardCollection $cards, Hand $hand): self
    {
        $cardGroups = $cards->groupByValue();

        $pair = $cardGroups->get(0)->first();
        $kicker = $cardGroups->get(1)->first();
        $definition = sprintf('Pair of %ss', $pair->name());

        return new static(
            self::ONE_PAIR,
            [$pair->value(), $kicker->value()],
            $cards,
            $definition,
            $hand
        );
    }
432
public function tokenizeCard(CreditCard $card)
    {
        $tokenizeCardRequest = new TokenizeCardRequest($this->merchant, $this->environment);

        return $tokenizeCardRequest->execute($card);
    }
158926
protected function mod10($cardNumber)
    {
        $cardNumber = strrev($cardNumber);
        $numSum = 0;
        for ($i = 0; $i < strlen($cardNumber); $i++) {
            $currentNum = substr($cardNumber, $i, 1);
            if ($i % 2 == 1) {
                $currentNum *= 2;
            }
            if ($currentNum > 9) {
                $firstNum = $currentNum % 10;
                $secondNum = ($currentNum - $firstNum) / 10;
                $currentNum = $firstNum + $secondNum;
            }
            $numSum += $currentNum;
        }

        return $numSum % 10 == 0;
    }
422809
protected function fillCardDetails($card)
    {
        if ($card) {
            $this->card_brand = $card->brand;
            $this->card_last_four = $card->last4;
        }

        return $this;
    }
114985
private static function isStraight(CardCollection $cards)
    {
        if ($cards->count() !== 5) {
            return false;
        }

        $uniqueCards = $cards->map->value()->unique();
        if ($cards->count() !== $uniqueCards->count()) {
            return false;
        }

        if ($cards->sumByValue() === array_sum(range(
            $cards->sortByValue()->first()->value(),
            $cards->sortByValue()->last()->value()
        ))) {
            return $cards->sortByValue()->values();
        }

        return false;
    }
1354217
public function card($card)
    {
        if ($card instanceof Card) {
            $this->card = $card;

            return $this;
        }

        if ($card instanceof Closure) {
            $card($new = new Card());
            $this->card = $new;

            return $this;
        }

        throw new InvalidArgumentException(
            'Invalid Card type. Expected '.Card::class.' or '.Closure::class.'.'
        );
    }
307044
public function assign(array $cards)
    {
        return json_encode(array_map(function ($card) {
            return $this->attachExtension($card['card_id'], $card);
        }, $cards));
    }
293367
public static function straightFlush(CardCollection $cards)
    {
        // check for flush
        if (($flushCards = static::flush($cards)) === false) {
            return false;
        }

        // check for straight, using the flush cards
        if (($straight = static::straight($flushCards)) === false) {
            return false;
        }

        return $straight;
    }
1159008
public function exportCardAsRawCard(Card $card)
    {
        $modelSignatures = [];
        foreach ($card->getSignatures() as $cardSignature) {
            $modelSignatures[] = new RawSignature(
                $cardSignature->getSigner(), $cardSignature->getSignature(), $cardSignature->getSnapshot()
            );
        }

        return new RawSignedModel($card->getContentSnapshot(), $modelSignatures);
    }
351834
protected function detectUsedDriversByCollections(array $collections)
    {
        $drivers = [];

        foreach ($collections as $collection) {
            $source = $collection
                ->getMetadata()
                ->getCollectionDataSource();
            $drivers[$source->getMasterServerId()] = $source
                ->getMasterServer()
                ->getConnection();
        }

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

        return $this;
    }
1204980
public function cards($parameters = [])
    {
        $cards = [];

        $parameters = array_merge(['limit' => 24], $parameters);

        $stripeCards = $this->asStripeCustomer()->sources->all(
            ['object' => 'card'] + $parameters
        );

        if (! is_null($stripeCards)) {
            foreach ($stripeCards->data as $card) {
                $cards[] = new Card($this, $card);
            }
        }

        return new Collection($cards);
    }
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
        );
    }
349209
public function generateRawCard(CardParams $cardParams)
    {
        $now = new DateTime();
        $publicKeyString = $this->cardCrypto->exportPublicKey($cardParams->getPublicKey());

        $rawCardContent = new RawCardContent(
            $cardParams->getIdentity(), base64_encode($publicKeyString), '5.0', $now->getTimestamp(), $cardParams->getPreviousCardID()
        );
        $rawCardContentSnapshot = json_encode($rawCardContent, JSON_UNESCAPED_SLASHES);

        $rawSignedModel = new RawSignedModel($rawCardContentSnapshot, []);

        try {
            $this->modelSigner->selfSign($rawSignedModel, $cardParams->getPrivateKey(), $cardParams->getExtraFields());
        } catch (VirgilException $e) {
            //model with empty signatures hasn't this exception
        }

        return $rawSignedModel;
    }
40903
function (cards) {
		var res = deckSize + 1;
		for (var c = 0; c < cards.length; c++)
			res = evaluator[res + getCode(cards[c])];
		if (cards.length < 7)
			res = evaluator[res];
		return {name: hands[res >> 12], value: res};
	}
1256080
public static function createFourOfAKind(CardCollection $cards, Hand $hand): self
    {
        $cardGroups = $cards->groupByValue();

        $firstGroup = $cardGroups->first()->first();
        $kickerGroup = $cardGroups->last()->first();

        $definition = sprintf('4 of a Kind - %ss', $firstGroup->name());

        return new static(
            self::FOUR_OF_A_KIND,
            [$firstGroup->value(), $kickerGroup->value()],
            $cards,
            $definition,
            $hand
        );
    }
302326
public static function twoPair(CardCollection $cards)
    {
        $pairOne = self::nNumberOfCardsInSet($cards, 2);
        $pairTwo = self::nNumberOfCardsInSet($cards->diff($pairOne), 2);

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

        $pairs = $pairOne->merge($pairTwo);

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

        return $pairs
            ->push($highCard)
            ->switchAceValue();
    }