FW: [PEAR-DEV] Announce: Crypt_Xtea (and possibly Crypt_Test)
| From: | Patrick O'Lone | Date: | Sun, 01 Sep 2002 10:10:31 +0000 |
| Subject: | FW: [PEAR-DEV] Announce: Crypt_Xtea (and possibly Crypt_Test) | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-8799@lists.php.net to get a copy of this message | ||
Why not just have the constructor of the actual singleton class just
check for this? If it fails in the constructor, just have it return a
Crypt_Error instance (instead of the normal object). This would follow a
more OOP-ish design, since the super-class has no dependency to the
underlying sub-classes. You should be able to do this easily with:
if (((extension_loaded('mcrypt') || dl('mcrypt.so')) &&
function_exists('mcrypt_cbc')) {
// Prepare instance
} else {
return new Crypt_Error(CRYPT_MISSING_EXTENSION);
}
If you have questions, comments, or need additional information about
the subject of this message, feel free to contact us via phone or
e-mail.
Regards,
Patrick O'Lone
------------------------------
TOWNNEWS.COM/INN
Internet Software Engineer
Phone: 309-743-0809
Toll: 800-579-6397
Fax: 309-743-0830
Email: polone@townnews.com
------------------------------
> -----Original Message-----
> From: jeroend@mail.JDSware.com
> [mailto:jeroend@mail.JDSware.com] On Behalf Of Jeroen Derks
> Sent: Saturday, August 31, 2002 12:51 PM
> To: Pierre-Alain Joye
> Cc: Martin Jansen; pear-dev@lists.php.net
> Subject: Re: [PEAR-DEV] Announce: Crypt_Xtea (and possibly Crypt_Test)
>
>
> Pierre-Alain Joye wrote:
> >
> > On Sat, 31 Aug 2002 17:54:36 +0200
> > Martin Jansen <mj@php.net> wrote:
> >
> > > > Wrapper around all of these ?
> >
> > > I don't understand the context of this question.
> >
> > Sorry, a bit tired :)
> >
> > Instead of many packages Crypt_XXXX, we can have one with all
> > cryting methods. Wrapper is not the right word, factory is.
>
> Good idea, however, for the Crypt_CBC class mcrypt is
> required, for the current others not. Perhaps then it is an
> idea to separate these classes into packages Crypt_Mcrypt and
> just Crypt (possibly having the factory in Crypt checking for
> mcrypt support) ?
>
> --
> drs. Jeroen Derks, CISSP, SCJP http://www.jeroenderks.com/
> jeroen@derks.it http://www.derks.it/
> Derks.IT gsm. +31 (0) 6 5577 8224
> Postbus 56791 fax. +31 (0) 84 870 6519
> 1040 AT Amsterdam tel. +31 (0) 20 777 5488
>