Re: PEAR::Validate, status, plan

From: Date: Thu, 11 Dec 2003 02:05:58 +0000
Subject: Re: PEAR::Validate, status, plan
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-24343@lists.php.net to get a copy of this message
I am attching some diffs which add a simple method to Validate, the purpose is to provide a simple interface to a multi lingual Validation object. The problem at the moment is that if you live in the US, you use a zip code, if you live in the UK you use a postcode, in the US it is ssn, in the UK national insurance. The 'simple' function now calls a method of the Validate_XX class called getNative, this takes a method name and returns a native method which validates the same information. this will allow you to do if (Validate::simple("zip", "BS4 5EF", "UK")){ echo "valid"; } which will lookup zip in the translation table and execute that method instead instead of something like this $locale = "UK"; include("Validate_$locale.php"); $v = new Validate_$locale; switch($locale){ case "US": $result = $v->zip(); break; case "UK": $result = $v->postcode(); break; etc... etc } if ($result){ echo "valid"; } It will also allow programmers to use their native language and abbreviations What do you guys think? Mike Pierre-Alain Joye wrote:
Hello, As you noticed, I'm working on Validate, trying to push a 1st beta asap. The plan is to have a 1st beta this year. That means the interface will be freezed at this time. So if anyone has comments or requests regarding the current interface (no FUD please :) ), please do it now. About locale validations classes -- I would like to get a lead per locale. He has to maitain his locale validation and create test cases. Obviously bugs related to his country will be assigned to him. However that does not mean he can do whatever he wants in the class :). Besides the respect of the defined interfaced (callback from multiple, std result), he should follow carefully the advices and features requests from the users. Current leads: -- AT: Michael Wallner DE: Stefan Neufeind NL: Dave Mertens pt_BR: Silvano Girardi Jr. PL: Piotr Klaban UK: Mike Dransfield To be taken: - FR (I have no more time to take of it) - any country that does not exist yet. Themes -- Apart from locales, we can add some themed validation schemes. Finance is the 1st of them. I open with any suggestion as far as we (peardev) agreed on its needs (ie we surely do not care about the ID of a foobar club in foobarland ;) ). ok, that's all, feel free to comment hth pierre


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