コード例 #1
0
 /**
  * @param UserId     $uid
  * @param ETokenType $type
  */
 public static function getUserTokensByType(UserId $uid, ETokenType $type)
 {
     $tokens = [];
     $tkns = UserTokens::findAll(['user_id' => $uid->getId(), 'token_type' => $type->getValue()]);
     foreach ($tkns as $var) {
         $tokenType = ETokenType::search($var->token_type);
         $token = new Token($var->token, ETokenType::$tokenType(), new UserId($var->user_id), $var->token_expiration_date);
         $tokens[] = $token;
     }
     return $tokens;
 }