Re: Question, what to do when finding an error whilevalidating data
| From: | John W. Holmes | Date: | Mon, 05 Apr 2004 19:48:12 +0000 |
| Subject: | Re: Question, what to do when finding an error whilevalidating data | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-182397@lists.php.net to get a copy of this message | ||
From: "Mike Zornek" <listguy@mikezornek.com>
> There is a column called Address in my email table, Thus I am creating a
PHP
> object called Email to interact with it. The Address variable of this
object
> will hold a string like "mikezornek@mikezornek.com".
>
> In the setAddress method should I check for a valid email address and
throw
> a warning then? And if so how?
>
> Or should I simply create a method isValidAddress and do the verification
in
> my own interface code?
Either way I would create a ValidAddress() method. I would use it as an
interface, but you could also have the default action of the set() method
also check it or have the validation within set() controlled by some flag.
---John Holmes...