@param CardCollection $cards

@return SevenCardResult
197058
public static function createTwoPair(CardCollection $cards, Hand $hand): self
    {
        $cardGroups = $cards->groupByValue();
        $firstCard = $cardGroups->get(0)->first();
        $secondCard = $cardGroups->get(1)->first();
        $kickerCard = $cardGroups->get(2)->first();

        $definition = sprintf(
            'Two Pair - %ss and %ss',
            $firstCard->name(),
            $secondCard->name()
        );

        return new static(
            self::TWO_PAIR,
            [$firstCard->value(), $secondCard->value(), $kickerCard->value()],
            $cards,
            $definition,
            $hand
        );
    }
705036
public function evaluateHands(CardCollection $board, HandCollection $playerHands): ResultCollection
    {
        return $this->cardEvaluationRules->evaluateHands($board, $playerHands);
    }
607961
public function all(array $params = array())
    {
        $endpoint = '/admin/gift_cards.json';
        $response = $this->request($endpoint, 'GET', $params);
        return $this->createCollection(GiftCard::class, $response['gift_cards']);
    }
42283
public function union($items): ArrayCollection
    {
        return new static(array_unique(array_merge($this->items, $this->itemsArray($items))));
    }
719629
public function cards(array $cards = [])
    {
        if (count($cards) > 10) {
            throw CouldNotCreateMessage::messageCardsLimitExceeded();
        }

        $this->cards = $cards;

        return $this;
    }
760855
public function wxCardPackage(array $card_list, $timestamp = null, $api_ticket = null)
    {
        if (!is_array($card_list)) {
            $this->setError('参数缺失');

            return false;
        }

        if (empty($timestamp) || $timestamp == '') {
            $timestamp = time();
        }

        if (empty($api_ticket) || $api_ticket == '') {
            $api_ticket = $this->cardApiTicket();
        }

        $resultArray = [];
        foreach ($card_list as $key => $value) {
            if (empty($value['code']) || !isset($value['code'])) {
                $value['code'] = '';
            }
            if (empty($value['openid']) || !isset($value['openid'])) {
                $value['openid'] = '';
            }
            $arrays = [$api_ticket, $timestamp, $value['card_id'], $value['code'], $value['openid']];
            sort($arrays, SORT_STRING);
            $string = sha1(implode($arrays));

            $resultArray['cardList'][$key]['cardId']            = $value['card_id'];
            $resultArray['cardList'][$key]['cardExt']['code']   = $value['code'];
            $resultArray['cardList'][$key]['cardExt']['openid'] = $value['openid'];

            $resultArray['cardList'][$key]['cardExt']['timestamp'] = $timestamp;
            $resultArray['cardList'][$key]['cardExt']['signature'] = $string;

            if (!empty($value['outer_id'])) {
                $resultArray['cardList'][$key]['cardExt']['outer_id'] = $value['outer_id'];
            }
            $resultArray['cardList'][$key]['cardExt'] = json_encode($resultArray['cardList'][$key]['cardExt']);
        }
        $resultJson = json_encode($resultArray);

        return $resultJson;
    }
1209640
public function getChildren()
    {
        $objs = $this->carddavBackend->getCards($this->addressBookInfo['id']);
        $children = [];
        foreach ($objs as $obj) {
            $obj['acl'] = $this->getChildACL();
            $children[] = new Card($this->carddavBackend, $this->addressBookInfo, $obj);
        }

        return $children;
    }
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;
    }
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);
    }
145274
public static function threeOfAKind(CardCollection $cards)
    {
        $judgedHand = self::nNumberOfCardsInSet($cards, 3);

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

        $highCards = $cards->diff($judgedHand)->sortByValue()->reverse()->take(2);

        return $judgedHand
            ->merge($highCards)
            ->switchAceValue()
            ->sortByValue();
    }
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();
    }
1005515
public function search(array $params = array())
    {
        $endpoint = '/admin/gift_cards/search.json';
        $response = $this->request($endpoint, 'GET', $params);
        return $this->createCollection(GiftCard::class, $response['gift_cards']);
    }
988327
public static function fromString(string $cards)
    {
        $cards = explode(' ', $cards);

        return static::make($cards)->map(function ($card) {
            return Card::fromString($card);
        });
    }
151853
public function setItems($items)
    {
        if ($items && !$items instanceof ItemBag) {
            $items = new MulticardsItemBag($items);
        }

        return $this->setParameter('items', $items);
    }
735406
public function publishCard(CardParams $cardParams)
    {
        $tokenContext = new TokenContext($cardParams->getIdentity(), 'publish');
        $token = $this->accessTokenProvider->getToken($tokenContext);

        $rawSignedModel = $this->generateRawCard(
            CardParams::create(
                [
                    CardParams::Identity       => $token->identity(),
                    CardParams::PrivateKey     => $cardParams->getPrivateKey(),
                    CardParams::PublicKey      => $cardParams->getPublicKey(),
                    CardParams::ExtraFields    => $cardParams->getExtraFields(),
                    CardParams::PreviousCardID => $cardParams->getPreviousCardID(),
                ]
            )
        );

        $card = $this->publishRawSignedModelWithToken($rawSignedModel, $token);

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

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

        return new static(
            self::FLUSH,
            [$highCard->first()->value()],
            $cards,
            $definition,
            $hand
        );
    }
351834
protected function detectUsedDriversByCollections(array $collections)
    {
        $drivers = [];

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

        return $drivers;
    }