Re: Imap Backend Propsal
| From: | Bertrand Mansion | Date: | Mon, 02 Feb 2004 09:41:12 +0000 |
| Subject: | Re: Imap Backend Propsal | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-25415@lists.php.net to get a copy of this message | ||
<richy@smilingsouls.net> wrote :
Hi Richard,
Thanks for the modifications you made. :)
> If the information is not present in the
> headers, then the variable is empty, why is that bad? imap_headerinfo is
> pretty black and white as far as what header information it provides. I don't
> understand why member variable creation is so taboo here.
IMHO, it is taboo because if the data does not exist in the header, then the
data contained in the object should reflect that. If you have var
$ccPersonal, one would expect it to be used in a way or another, otherwise
why declare it ? If a data does not exist, it does not mean it is empty. It
can exist and be empty. That's the difference I see between empty() and
isset().
If you had an instance var called $header = array(), you could fill it with
any header found while parsing the headers. You might want to have a look at
the mailparse extension, but unfortunately it is very badly documented and
the OO interface is not even documented.
Now, for the getXxx() accessors methods, I agree that they are not really
necessary in the way you see them. But this could be achieved using overload
in the way DB_Dataobject does it. With PHP5 I think you could use the
special method __get(). This method would check if the value is present in
var $header and return it or null if not set.
About your helper methods, they should belong to some other class as they
could be used by other packages as well (think about Mail_POP3...).
Bertrand Mansion
Mamasam