Commit 2ab8c4e5 authored by sopel's avatar sopel

Credit card validator added (Ticket #15)

parent 46bc40f7
<?php
class Doctrine_Validator_Creditcard {
/**
* @link http://www.owasp.org/index.php/OWASP_Validation_Regex_Repository
* @param Doctrine_Record $record
* @param string $key
* @param mixed $value
* @param string $args
* @return boolean
*/
public function validate(Doctrine_Record $record, $key, $value, $args) {
return preg_match('#^((4\d{3})|(5[1-5]\d{2})|(6011)|(7\d{3}))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$#', $value);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment