Re: [Fwd: Re: PEAR framework changes for PHP5]
| From: | Stefan Neufeind | Date: | Sat, 31 Jan 2004 02:22:33 +0000 |
| Subject: | Re: [Fwd: Re: PEAR framework changes for PHP5] | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-25360@lists.php.net to get a copy of this message | ||
On 30 Jan 2004 at 21:05, Hans Lellelid wrote:
> 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:
> >
> > /*
> > * 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. :)
>
> 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).
Just to mention: Image_Graph (version 0.2, only in CVS yet) does
similar. Before even including the classfile it checks if the class
is already known. Otherwise try to load a file and check again.
Didn't know about this "magic way to do it" (and in detail: that Log
already does it) before - but it's the most logical way to do it
imho.
Regards,
Stefan