Re: [Fwd: Re: PEAR framework changes for PHP5]
| From: | Hans Lellelid | Date: | Sat, 31 Jan 2004 02:05:16 +0000 |
| Subject: | Re: [Fwd: Re: PEAR framework changes for PHP5] | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-25359@lists.php.net to get a copy of this message | ||
Jon Parise wrote:
It's probably non-obvious, but the Log package already supports this. Here's the relevant code from the Log::factory() implementation: /*I think having a way to refer to classes would still be useful -- e.g. so that driver classes could be specified in a conf file (of course in that case it would have to a simple text representation, rather than two element array). Hans* Attempt to include our version of the named class, but don't treat * a failure as fatal. The caller may have already included their own * version of the named class. */@include_once $classfile; /* If the class exists, return a new instance of it. */ if (class_exists($class)) {return new $class($name, $ident, $conf, $level);} Heh -- that's cool; thanks for pointing that out to me. It would be great if PEAR classes would at least conform to that, then, so that it would be possible to create drivers/containers anywhere. Maybe they do & I just haven't realized it. :)