Bluz\Validator\Rule\CreditCard::validate PHP Method

validate() public method

Check input data
public validate ( string $input ) : boolean
$input string
return boolean
    public function validate($input) : bool
    {
        $input = preg_replace('([ \\.-])', '', $input);
        if (!is_numeric($input)) {
            return false;
        }
        return $this->verifyMod10($input);
    }

Usage Example

Beispiel #1
0
 /**
  * @dataProvider providerForFail
  * @expectedException \Bluz\Validator\Exception\ValidatorException
  */
 public function testInvalidCreditCardsShouldThrowCreditCardException($input)
 {
     $this->assertFalse($this->validator->validate($input));
     $this->assertFalse($this->validator->assert($input));
 }