Returns true if the card meets a valid mod10 (Luhn Algorithm) check
@param bool
339386
static function IsValidMod10($str)
	{
	   if (strspn($str, "0123456789") != strlen($str))
	   {
	      return false;
	   }

	   $map = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // for even indices
	                0, 2, 4, 6, 8, 1, 3, 5, 7, 9); // for odd indices
	   $sum = 0;
	   $last = strlen($str) - 1;

	   for ($i = 0; $i <= $last; $i++)
	   {
	      $sum += $map[$str[$last - $i] + ($i & 1) * 10];
	   }

	   return $sum % 10 == 0;
	}
550416
public static boolean compareMagics (byte[] magic1,byte[] magic2) {
	if (magic1.length!=magic2.length) {
		return false;
	}
	for (int i=0;i<magic1.length;i++) {
		if (magic1[i]!=magic2[i]) {
			 return false;
		}
	}
	return true;	

}
32045
function isCreditCard(str) {
  (0, _assertString.default)(str);
  var sanitized = str.replace(/[- ]+/g, '');

  if (!creditCard.test(sanitized)) {
    return false;
  }

  var sum = 0;
  var digit;
  var tmpNum;
  var shouldDouble;

  for (var i = sanitized.length - 1; i >= 0; i--) {
    digit = sanitized.substring(i, i + 1);
    tmpNum = parseInt(digit, 10);

    if (shouldDouble) {
      tmpNum *= 2;

      if (tmpNum >= 10) {
        sum += tmpNum % 10 + 1;
      } else {
        sum += tmpNum;
      }
    } else {
      sum += tmpNum;
    }

    shouldDouble = !shouldDouble;
  }

  return !!(sum % 10 === 0 ? sanitized : false);
}
610823
public static function isValidCvv($card)
	{
		$isValid = false;

		if(isset($card['cvv'])) {

			$isCvvEmpty = CheckoutApi_Lib_Validator::isEmpty($card['cvv']);
			
			if(!$isCvvEmpty && CheckoutApi_Lib_Validator::isValidCvvLen($card['cvv'])) {
			
				$isValid = true;
			
			}
		}
		return $isValid;
	}
546706
public static function isSupportedSigningAlgorithm($algorithm)
    {
        return in_array(
            $algorithm,
            array(
                XMLSecurityKey::RSA_1_5,
                XMLSecurityKey::RSA_SHA1,
                XMLSecurityKey::RSA_SHA256,
                XMLSecurityKey::RSA_SHA384,
                XMLSecurityKey::RSA_SHA512
            )
        );
    }
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); });
    }
  }
912622
private boolean matchLemmaRegexp(AnalyzedTokenReadings aToken,
      Pattern pattern) {
    boolean matches = false;
    for (AnalyzedToken analyzedToken : aToken) {
      final String posTag = analyzedToken.getLemma();
      if (posTag != null) {
        final Matcher m = pattern.matcher(posTag);
        if (m.matches()) {
          matches = true;
          break;
        }
      }
    }
    return matches;
  }
1232193
private boolean checkPlTaxNumber(final String ptaxNumber) {
    final int checkSum = ptaxNumber.charAt(ptaxNumber.length() - 1) - '0';
    int calculatedCheckSum;
    if (StringUtils.length(ptaxNumber) == 11) {
      // PESEL
      final int sum = (ptaxNumber.charAt(0) - '0') * 1 //
          + (ptaxNumber.charAt(1) - '0') * 3 //
          + (ptaxNumber.charAt(2) - '0') * 7 //
          + (ptaxNumber.charAt(3) - '0') * 9 //
          + (ptaxNumber.charAt(4) - '0') * 1 //
          + (ptaxNumber.charAt(5) - '0') * 3 //
          + (ptaxNumber.charAt(6) - '0') * 7 //
          + (ptaxNumber.charAt(7) - '0') * 9 //
          + (ptaxNumber.charAt(8) - '0') * 1 //
          + (ptaxNumber.charAt(9) - '0') * 3;
      calculatedCheckSum = sum % 10;
      if (calculatedCheckSum != 0) {
        calculatedCheckSum = 10 - sum % 10;
      }
    } else {
      // NIP
      final int sum = (ptaxNumber.charAt(0) - '0') * 6 //
          + (ptaxNumber.charAt(1) - '0') * 5 //
          + (ptaxNumber.charAt(2) - '0') * 7 //
          + (ptaxNumber.charAt(3) - '0') * 2 //
          + (ptaxNumber.charAt(4) - '0') * 3 //
          + (ptaxNumber.charAt(5) - '0') * 4 //
          + (ptaxNumber.charAt(6) - '0') * 5 //
          + (ptaxNumber.charAt(7) - '0') * 6 //
          + (ptaxNumber.charAt(8) - '0') * 7;
      calculatedCheckSum = sum % MODULO_11;
    }
    return checkSum == calculatedCheckSum;
  }
340980
public static function isCardIdValid($param)
	{
		$isValid = false;
        if(isset($param['card'])) {
		$card = $param['card'];

		if(isset($card['id'])) {

			$isCardIdEmpty = CheckoutApi_Lib_Validator::isEmpty($card['id']);

			if(!$isCardIdEmpty && CheckoutApi_Lib_Validator::isString($card['id']) )
			{
				$isValid = true;
			}
		}

		return $isValid;
        }
        return true;

	}
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;
    }
113642
public static boolean hasModifier(Class<?> clazz, ModifierType... modifierTypes) {
		if (null == clazz || ArrayUtil.isEmpty(modifierTypes)) {
			return false;
		}
		return 0 != (clazz.getModifiers() & modifiersToInt(modifierTypes));
	}
913393
def valid?
      return false if !@name.nil? && @name.to_s.length > 500
      return false if @quantity.nil?
      return false if @quantity.to_s.length > 5
      return false if @quantity.to_s.length < 1
      return false if !@note.nil? && @note.to_s.length > 500
      return false if !@catalog_object_id.nil? && @catalog_object_id.to_s.length > 192
      return false if !@variation_name.nil? && @variation_name.to_s.length > 255
      return true
    end
106796
public boolean isChecksumValid() {
        if(checksum == 0)
            return true;

        int crc = CRCUtils.getCRC(getHeader());
        if(data != null && data.length > 0) {
            crc = CRCUtils.getCRC(data, crc);
        }

        return (checksum == crc);
    }
1293374
private boolean checkDeTaxNumber(final String ptaxNumber) {
    final int fa = Integer.parseInt(StringUtils.substring(ptaxNumber, 2, 4));
    final int sb = Integer.parseInt(StringUtils.substring(ptaxNumber, 5, 8));
    final int checkSum = ptaxNumber.charAt(12) - '0';
    if (StringUtils.startsWith(ptaxNumber, "11")) {
      // Berlin
      final int calculatedCheckSum;
      if (fa >= 27 && fa <= 30 //
          || fa < 31 && (sb < 201 || sb > 693) //
          || fa == 19 && (sb < 200 || sb > 639 && sb < 680 || sb > 680 && sb < 684 || sb > 684) //
          || fa == 37) {
        calculatedCheckSum = ((ptaxNumber.charAt(5) - '0') * 7 //
            + (ptaxNumber.charAt(6) - '0') * 6 //
            + (ptaxNumber.charAt(7) - '0') * 5 //
            + (ptaxNumber.charAt(8) - '0') * 8 //
            + (ptaxNumber.charAt(9) - '0') * 4 //
            + (ptaxNumber.charAt(10) - '0') * 3 //
            + (ptaxNumber.charAt(11) - '0') * 2) //
            % MODULO_11;
      } else {
        calculatedCheckSum = ((ptaxNumber.charAt(2) - '0') * 3 //
            + (ptaxNumber.charAt(3) - '0') * 2 //
            + (ptaxNumber.charAt(4) - '0') * 9 //
            + (ptaxNumber.charAt(5) - '0') * 8 //
            + (ptaxNumber.charAt(6) - '0') * 7 //
            + (ptaxNumber.charAt(7) - '0') * 6 //
            + (ptaxNumber.charAt(8) - '0') * 5 //
            + (ptaxNumber.charAt(9) - '0') * 4 //
            + (ptaxNumber.charAt(10) - '0') * 3 //
            + (ptaxNumber.charAt(11) - '0') * 2) //
            % MODULO_11;
      }
      return checkSum == calculatedCheckSum;
    }
    // TODO find checksum calculation routines for the rest
    return true;
  }
1225090
protected function _calculateRefMod10v5($number)
    {
        $number = preg_replace("/\D/", "", $number);

        // The seed number needs to be numeric
        if (!is_numeric($number)) {
            return false;
        }

        // Must be a positive number
        if ($number <= 0) {
            return false;
        }

        // Get the length of the seed number
        $length = strlen($number);

        $total = 0;

        // For each character in seed number, sum the character multiplied by its one
        // based array position (instead of normal PHP zero based numbering)
        for ($i = 0; $i < $length; $i++) {
            $total += $number{$i} * ($i + 1);
        }

        // The check digit is the result of the sum total from above mod 10
        $checkDigit = fmod($total, 10);

        // Return the original seed plus the check digit
        return $number . $checkDigit;
    }
707600
private function validateIsbn10(): bool
    {
        $value = \str_replace(['-', ' '], '', $this->value);
        if (!\preg_match($this->patterns['isbn10-basic'], $value)) {
            $this->setError(self::VALIDATOR_ERROR_ISBN_INCORRECT_FORMAT);
            return false;
        }

        $sum = 0;
        for ($i = 0; $i < 9; $i++) {
            $sum += (10 - $i) * $value{$i};
        }

        $checksum = 11 - ($sum % 11);
        if ($checksum == 11) {
            $checksum = '0';
        } elseif ($checksum == 10) {
            $checksum = 'X';
        }
        $isValid = \substr($value, -1) == $checksum ? true : false;
        if (!$isValid) {
            $this->setError(self::VALIDATOR_ERROR_ISBN_INVALID_NUMBER);
        }
        return $isValid;
    }
94206
private static boolean match(char c, long lowMask, long highMask) {
        if (c < 64)
            return ((1L << c) & lowMask) != 0;
        if (c < 128)
            return ((1L << (c - 64)) & highMask) != 0;
        return false;
    }