RE: [PEAR-DEV] [RFC] Validation class proposal

From: Date: Thu, 23 May 2002 06:53:49 +0000
Subject: RE: [PEAR-DEV] [RFC] Validation class proposal
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-6350@lists.php.net to get a copy of this message
Hello, Pierre-Alain and me were discussing about that. Wouldn't it be better to have a kind of container thing. Having a huge class with lots of methods like (checkemail, checkthisthing ...) isn't a nice way to go according to us. What about having a string container, a numeric, etc... It makes for a more extensible system. Pierre-alain has an idea on it, he should post something this morning. > Let's stop wasting time talking and go to code something :-) My quick > proposal (sorry if I'm too cursory): > > Dir structure > ------------- > > pear/Validate > > Validate.php > > pear/Validate/I18N/ > > ES.php > DE.php > FR.php > > Validate.php > ------------ > > Statics methods, easy syntax, return bool and all common validation > routines inside, even if it gets a little long. Something like: > > // 0-9 > define(NUM_NATURAL, 1); > // a-Z > define(ALPHA, 2); > // a-Z + áé.. > define(EALPHA, 4); > // \s* > define(SPACE, 8); > define(DECIMAL, 16); > > class Validate > { > function email($email, $domain_check=false) > function string($str, NUM+ALPHA, $lenght_check=false) > function creditCard($no) > // process an array (mostly for $_POST, $_GET) in the form: > // 0 => array($val, $options) > // where $options=>array(method, args, nullable) > function batch($array) > function date($date, $format, $range) > function youCanBeHere() > } > > I18N/ES.php > --------------- > > class ValidateES > { > // Spanish Identity card validation > function dni($str) > } > > > Tomas V.V.Cox > > -- > PEAR Development Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.pear.dev (#6350) next »