RE: [PEAR-DEV] Validation class comments
| From: | Richard Heyes | Date: | Tue, 28 May 2002 18:30:37 +0000 |
| Subject: | RE: [PEAR-DEV] Validation class comments | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6539@lists.php.net to get a copy of this message | ||
> > I can't imagine a lot of cases when ALL this functions will be necessary.
> > So such class must have pluggable architecture, and allow easily include and
> > exclude validation functions from working script.
>
> Normally validation methods are small and I'm against having to include
> 10 files for just do the common validations. To include a 20K file (if
> it reach that size at some point) is better than include 3 o 4 files of
> 5K.
On this point, you could always use some sort of autoload functionality.
Eg:
...
function isEmail($email)
{
require_once('Mail/RFC822.php');
return Mail_RFC822::isValidInetAddress($email);
}
function isCCNumber($number)
{
require_once('CC/blaat.php');
return CC_blaat::isValidCCNumber($number);
}
...
--
Richard Heyes
Need webmail? http://www.v-webmail.co.uk