Field has to be a valid credit card number format.

@see https://github.com/funkatron/inspekt/blob/master/Inspekt.php
@param string $message
@return FormValidator
165549
public function ccnum($message = null)
    {
        $this->setRule(__FUNCTION__, function($value)
                       {
                           $value = str_replace(' ', '', $value);
                           $length = strlen($value);

                           if ($length < 13 || $length > 19) {
                               return FALSE;
                           }

                           $sum = 0;
                           $weight = 2;

                           for ($i = $length - 2; $i >= 0; $i--) {
                               $digit = $weight * $value[$i];
                               $sum += floor($digit / 10) + $digit % 10;
                               $weight = $weight % 2 + 1;
                           }

                           $mod = (10 - $sum % 10) % 10;

                           return ($mod == $value[$length - 1]);
                       }, $message);
        return $this;
    }
553387
public function validate($value)
    {
        $return = $this->validateCommon($value, new ValidateResult($value, true));

        if ($return->status === false) {
            return $return;
        }

        return $this->validateNumber($return->value);
    }
1336343
public static function invalidCardString($value, $message = null)
    {
        $defaultMessage = sprintf('Cannot create card from string given: "%s"', $value);
        $message = is_null($message) ? $defaultMessage : $message;

        return new static($message);
    }
124578
public function message($message)
    {
        if (is_string($message) || is_numeric($message)) {
            $message = new Text($message);
        }

        if (!($message instanceof Message)) {
            throw new InvalidArgumentException('Invalid message.');
        }

        $this->message = $message;

        return $this;
    }
1347168
protected function useValidator(Validator $validator)
    {
        if (substr($this->account, 2, 2) == '99') {
            return $validator === $this->validators[2]
                || $validator === $this->validators[3];

        } else {
            return  $validator !== $this->validators[2];

        }
    }
1236769
protected function validate_valid_cc($field, $input, $param = null)
    {
        if (!isset($input[$field]) || empty($input[$field])) {
            return;
        }

        $number = preg_replace('/\D/', '', $input[$field]);

        if (function_exists('mb_strlen')) {
            $number_length = mb_strlen($number);
        } else {
            $number_length = strlen($number);
        }


        /**
         * Bail out if $number_length is 0. 
         * This can be the case if a user has entered only alphabets
         * 
         * @since 1.5
         */
        if( $number_length == 0 ) {
            return array(
                'field' => $field,
                'value' => $input[$field],
                'rule' => __FUNCTION__,
                'param' => $param,
            );
        }


        $parity = $number_length % 2;

        $total = 0;

        for ($i = 0; $i < $number_length; ++$i) {
            $digit = $number[$i];

            if ($i % 2 == $parity) {
                $digit *= 2;

                if ($digit > 9) {
                    $digit -= 9;
                }
            }

            $total += $digit;
        }

        if ($total % 10 == 0) {
            return; // Valid
        }

        return array(
            'field' => $field,
            'value' => $input[$field],
            'rule' => __FUNCTION__,
            'param' => $param,
        );
    }
1314567
public function validate(BaseModel $model, $rules = null, $messages = [])
    {
        return $this->validateAndPrefixErrors(null, $model, $rules, $messages);
    }
450274
public function thenInvalid($message)
    {
        $this->thenPart = function ($v) use ($message) { throw new \InvalidArgumentException(sprintf($message, json_encode($v))); };

        return $this;
    }
1358814
public function addValidation($validation, $value = null)
    {
        if (false === isset($this->validation[$validation])) {
            $this->validation[$validation] = [];
        }

        $this->validation[$validation][] = $value;

        return $this;
    }
484222
public function integer($message = null)
    {
        $this->setRule(__FUNCTION__, function($val)
                       {
                           return !(filter_var($val, FILTER_VALIDATE_INT) === FALSE);
                       }, $message);
        return $this;
    }
988035
public function createCreateForm(Message $message)
    {
        if ($message->getBaseType() == "CHECK") {
            $form = $this->createForm(\BisonLab\SakonninBundle\Form\CheckType::class, $message, array(
                'action' => $this->generateUrl('message_create'),
                'method' => 'POST',
            ));
        } else {
            $form = $this->createForm(\BisonLab\SakonninBundle\Form\MessageType::class, $message, array(
                'action' => $this->generateUrl('message_create'),
                'method' => 'POST',
            ));
        }
        $form->add('submit', SubmitType::class, array('label' => 'Send'));
        return $form;
    }
401206
public function decodeMessage($message, $data)
    {
        // Get message descriptor
        $pool = DescriptorPool::getGeneratedPool();
        $messageType = $pool->getDescriptorByClassName(get_class($message));
        try {
            return $this->decodeMessageImpl($message, $messageType, $data);
        } catch (\Exception $e) {
            throw new ValidationException(
                "Error decoding message: " . $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
    }
313221
public function a($message) {
        return isset($this->messages[$message]) ? $this->messages[$message] : $message;
    }
423533
public function addRule($validation, $message, $severity = Validator\Rule::ERROR)
    {
        $this->rules[] = new Validator\Rule(
            $this->entity,
            $this->_getValidation($validation),
            $message,
            $this->property,
            $severity,
            $this->child
        );
        return $this;
    }
679695
public static function invalidId($message = null)
    {
        $defaultMessage = 'ID passed to the Game must be a valid UUID';
        $message = is_null($message) ? $defaultMessage : $message;

        return new static($message);
    }
1078755
public static function isCardNumberValid($param)
	{
		$isValid = false;

		if(isset($param['number'])) {

			$errorIsEmpty = CheckoutApi_Lib_Validator::isEmpty($param['number']) ;
			
			if(!$errorIsEmpty) {
				//$this->logError(true, "Card number can not be empty.", array('card'=>$param),false);
				$isValid = true;
			}

		} 

		return $isValid;
	}
1375066
public function validate($message): array
    {
        if (\is_array($message)) {
            $message = CloudMessage::fromArray($message);
        }

        if (!($message instanceof Message)) {
            throw new InvalidArgumentException(
                'Unsupported message type. Use an array or a class implementing %s'.Message::class
            );
        }

        try {
            $response = $this->messagingApi->validateMessage($message);
        } catch (NotFound $e) {
            throw (new InvalidMessage($e->getMessage(), $e->getCode()))
                ->withResponse($e->response());
        }

        return JSON::decode((string) $response->getBody(), true);
    }