Пример #1
0
 /**
  * Picks the card with given code.
  *
  * @param string $code
  *
  * @return array An array with the following keys:
  *               code, role and consumed.
  *
  * @throws NonExistentCodeSharedException
  */
 public function pick($code)
 {
     try {
         return $this->pickCardInternalWorker->pick($code);
     } catch (NonExistentCodeInternalException $e) {
         throw new NonExistentCodeSharedException();
     }
 }
Пример #2
0
 /**
  * Picks the profile with given uniqueness.
  *
  * @param string $uniqueness
  *
  * @return Profile
  */
 public function pick($uniqueness)
 {
     $assignedCards = $this->connectToAssignedCardStorageInternalWorker->connect()->find(['uniqueness' => $uniqueness])->fields(['_id' => 0]);
     $cards = [];
     foreach ($assignedCards as $assignedCard) {
         $cards[] = $this->pickCardInternalWorker->pick($assignedCard['card']);
     }
     return ['uniqueness' => $uniqueness, 'cards' => $cards];
 }