Gets a {@link Card} object from the user input, if all fields are valid. If not, returns
{@code null}.

@return a valid {@link Card} object based on user input, or {@code null} if any field is
invalid
422235
@Nullable
    public Card getCard() {
        String cardNumber = mCardNumberEditText.getCardNumber();
        int[] cardDate = mExpiryDateEditText.getValidDateFields();
        if (cardNumber == null || cardDate == null || cardDate.length != 2) {
            return null;
        }

        // CVC/CVV is the only field not validated by the entry control itself, so we check here.
        String cvcValue = mCvcNumberEditText.getText().toString().trim();
        if (!isCvcLengthValid()) {
            return null;
        }

        return new Card(cardNumber, cardDate[0], cardDate[1], cvcValue)
                .addLoggingToken(LOGGING_TOKEN);
    }
489664
def card(self):
        
        body, more, is_markdown = self._entry_content
        return TrueCallableProxy(
            self._get_card,
            body or more) if is_markdown else CallableProxy(None)
1219051
public static JsonInputValidator getValidator(Class<?> clazz) {
        if (clazz.equals(Scope.class)) {
            return ScopeValidator.getInstance();
        }
        if (clazz.equals(ApplicationInfo.class)) {
            return ApplicationInfoValidator.getInstance();
        }
        return null;
    }
188102
function (params, state, cb) {
                  state = state || {};

                  if (Card.getCardData) {
                    Card.getCardData(params, state, function (err, viewModel, clientLocals) {
                      cb(err, params, state, viewModel, clientLocals);
                    });
                  }
                  else {
                    cb(null, params, state, null, null);
                  }
                }
851775
public static CardTerminal getTheReader(String spec) throws CardException {
        try {
            String msg = "This application expects one and only one card reader (with an inserted card)";
            TerminalFactory tf = getTerminalFactory(spec);
            CardTerminals tl = tf.terminals();
            List<CardTerminal> list = tl.list(State.CARD_PRESENT);
            if (list.size() > 1) {
                throw new CardException(msg);
            } else if (list.size() == 1) {
                return list.get(0);
            } else {
                List<CardTerminal> wl = tl.list(State.ALL);
                // FIXME: JNA-s CardTerminals.waitForChange() does not work
                if (wl.size() == 1) {
                    CardTerminal t = wl.get(0);
                    System.out.println("Waiting for a card insertion to " + t.getName());
                    if (t.waitForCardPresent(0)) {
                        return t;
                    } else {
                        throw new CardException("Could not find a reader with a card");
                    }
                } else {
                    throw new CardException(msg);
                }
            }
        } catch (NoSuchAlgorithmException e) {
            throw new CardException(e);
        }
    }
912545
@Override
    public List<BaseCell> getItems(@NonNull Card card) {
        if (card.style != null && !TextUtils.isEmpty(card.style.forLabel)) {
            String forId = card.style.forLabel;
            if (mIdCardCache.containsKey(forId)) {
                Card forCard = mIdCardCache.get(forId);
                // if the "forLabel" card is empty, this card also should be empty
                if (forCard.mCells.size() == 0) {
                    if (TextUtils.isEmpty(forCard.load)) {
                        return null;
                    } else {
                        return Collections.emptyList();
                    }
                }
            }
        }

        if (TextUtils.isEmpty(card.load) && card.mCells.isEmpty()) {
            return null;
        }
        return new LinkedList<>(card.mCells);
    }
76380
def getCard(self, name):
        
        cards = self.projectCards

        for card in cards:
            if card.name.upper() == name.upper():
                return card

        return None
96881
public <T extends Iced> T get() {
    touch();
    Iced pojo = (Iced)_pojo;    // Read once!
    if( pojo != null ) return (T)pojo;
    pojo = TypeMap.newInstance(_type);
    pojo.read(new AutoBuffer(memOrLoad()));
    pojo.init(_key);
    return (T)(_pojo = pojo);
  }
197742
public HppRequest addCardStorageEnable(boolean cardStorageEnable) {
		this.cardStorageEnable = cardStorageEnable ? Flag.TRUE.getFlag() : Flag.FALSE.getFlag();
		return this;
	}
930164
public static Cardholder retrieve(String cardholder) throws StripeException {
    return retrieve(cardholder, (Map<String, Object>) null, (RequestOptions) null);
  }
789960
public boolean validateCardNumber() {
        boolean cardNumberIsValid =
                CardUtils.isValidCardNumber(mCardNumberEditText.getCardNumber());
        mCardNumberEditText.setShouldShowError(!cardNumberIsValid);
        return cardNumberIsValid;
    }
1160750
final function cardIdForJustCreated($c) {/** @var Card|null $card */return
		!($card = df_first($this->cards($c))) ? null : df_result_sne($card->id())
	;}
290311
function() {
    var valid = false;
    var destroy = true;
    var target = this;
    Crafty('Card').each(function() {
      if (this.intersect(target.x + target.w + game.config.cardBuffer, target.y, target.w, target.h) ||
          this.intersect(target.x - target.w - game.config.cardBuffer, target.y, target.w, target.h) ||
          this.intersect(target.x, target.y + target.h + game.config.cardBuffer, target.w, target.h) ||
          this.intersect(target.x, target.y - target.h - game.config.cardBuffer, target.w, target.h)
        ) {
        valid = true;
        destroy = false;
      }
      if (this.intersect(target.x, target.y, target.w, target.h)) {
        destroy = false;
      }
    });
    if (valid) {
      this.used = false;
    }
    else if (destroy) {
      this.destroy();
      var currentTarget = this;
      game.targets = _.reject(game.targets, function(thisTarget) { return _.isEqual(thisTarget, currentTarget); });
    }
  }
1149516
@ApiModelProperty(required = true, value = "Primary account number that uniquely identifies this card.")
   @JsonProperty("pan")
   @NotNull
   @Pattern(regexp = "[0-9]{1,19}")
   @Masked
   public String getPan() {
      return pan;
   }
1121343
static boolean isValidLuhnNumber(@Nullable String cardNumber) {
        if (cardNumber == null) {
            return false;
        }

        boolean isOdd = true;
        int sum = 0;

        for (int index = cardNumber.length() - 1; index >= 0; index--) {
            char c = cardNumber.charAt(index);
            if (!Character.isDigit(c)) {
                return false;
            }

            int digitInteger = Character.getNumericValue(c);
            isOdd = !isOdd;

            if (isOdd) {
                digitInteger *= 2;
            }

            if (digitInteger > 9) {
                digitInteger -= 9;
            }

            sum += digitInteger;
        }

        return sum % 10 == 0;
    }
1012811
@NonNull
    protected List<LayoutHelper> transformCards(@Nullable List<L> cards, final @NonNull List<C> data,
                                                @NonNull List<Pair<Range<Integer>, L>> rangeCards) {
        if (cards == null || cards.size() == 0) {
            return new LinkedList<>();
        }


        int lastPos = data.size();
        List<LayoutHelper> helpers = new ArrayList<>(cards.size());
        for (int i = 0, size = cards.size(); i < size; i++) {
            L card = cards.get(i);

            if (card == null) continue;

            final String ctype = getCardStringType(card);
            List<C> items = getItems(card);
            if (items == null) {
                // skip card null
                continue;
            }

            data.addAll(items);

            // calculate offset to set ranges
            int offset = lastPos;
            lastPos += items.size();
            // include [x, x) for empty range, upper are not included in range
            rangeCards.add(Pair.create(Range.create(offset, lastPos), card));

            // get layoutHelper for this card
            LayoutBinder<L> binder = mCardBinderResolver.create(ctype);
            LayoutHelper helper = binder.getHelper(ctype, card);


            if (helper != null) {
                helper.setItemCount(items.size());
                helpers.add(helper);
            }
        }

        return helpers;
    }
380107
public static String[] isValidCard10(String idCard) {
		if(StrUtil.isBlank(idCard)) {
			return null;
		}
		String[] info = new String[3];
		String card = idCard.replaceAll("[\\(|\\)]", "");
		if (card.length() != 8 && card.length() != 9 && idCard.length() != 10) {
			return null;
		}
		if (idCard.matches("^[a-zA-Z][0-9]{9}$")) { // 台湾
			info[0] = "台湾";
			String char2 = idCard.substring(1, 2);
			if (char2.equals("1")) {
				info[1] = "M";
			} else if (char2.equals("2")) {
				info[1] = "F";
			} else {
				info[1] = "N";
				info[2] = "false";
				return info;
			}
			info[2] = isValidTWCard(idCard) ? "true" : "false";
		} else if (idCard.matches("^[1|5|7][0-9]{6}\\(?[0-9A-Z]\\)?$")) { // 澳门
			info[0] = "澳门";
			info[1] = "N";
		} else if (idCard.matches("^[A-Z]{1,2}[0-9]{6}\\(?[0-9A]\\)?$")) { // 香港
			info[0] = "香港";
			info[1] = "N";
			info[2] = isValidHKCard(idCard) ? "true" : "false";
		} else {
			return null;
		}
		return info;
	}