Re: [UPDATE][PROPOSAL] Package: SMS (send and recieveSMSthrough different backends)

From: Date: Fri, 24 Oct 2003 07:28:07 +0000
Subject: Re: [UPDATE][PROPOSAL] Package: SMS (send and recieveSMSthrough different backends)
References: 1 2 3 4 5 6  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-22950@lists.php.net to get a copy of this message
function factory('driver',options) { require once ... driver $x = new $class; $ret = $x->init($options); return PEAR::isError($ret) ? $ret : $x; } Tobias Schlitt wrote:
<zitiere wer="Alan Knowles">
Which is solved by using a factory :)
Not necessarily. How will teh factory method be notified if an error occurs in the constructor of a driver? I think the init() method is quite usefull to handle initialization of the backend. A normal constructor is used to "create an instance of a defined class" and init() is used to "initialize a specific backend" which is out of scope from the class itself. If you do not use a specific backend you can just set _init = true. Maybe the init method of the driver could be called in the factory. Regards, Toby
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

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