Re: Tree-class for PEAR

From: Date: Fri, 01 Feb 2002 08:53:43 +0000
Subject: Re: Tree-class for PEAR
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-4315@lists.php.net to get a copy of this message
On Thu, 2002-01-31 at 10:42, Wolfram Kriesing wrote: > > >> as i announced yesterday i have written a PEAR-conform Tree > > >> class which can handle trees, which are either read from the DB > > >> or an XML file, you can manipulate, navigate etc. in the tree > > > > > >I vote yes > > > > +1. Even though I do not have the time to look deeper into > > Wolfram's code at the moment, I think we should have a rock-solid > > mechanism to build tree structures in PEAR. > > well i have one issue that might be necessary to clear out before > committing the Tree class to PEAR > > I extend the classes either from "myPEAR_Common" or > "myPEAR_CommonDB", those classes contain common functionality which i > use throughout a lot of classes and which is also used throughout > many other classes in PEAR, and until now, if i am right, it is > always copy-pasted into the different classes. > those classes contain: > > > myPEAR_Common: > ----------------------- > - setOption( $option, $value) > - setOptions( $options) > - getOption( $option ) > all those methods set/get values in the internal property-array > "options" just as it is used in PEAR::DB, which is used to configure > the class extending it > all those methods work on the internal array "options" just as it > works in PEAR::DB > > > myPEAR_CommonDB extends myPEAR_Common > ------------------------------------------------------- > - _connect > this method connects to the DB using the given DSN upon calling the > constructor, it also verifies the DSN, since that is needed in > multiple classes > > > > i am thinking of the following ways to solve this: > 1. > put those classes into the file PEAR.php, which is producing overhead > in this file, since not every application uses the options-thing > 2. > writing a class that extends PEAR.php and putting it in there and let > classes, which use options exnted this class > 3. > copy-pasting it in each class :-( > > i'd like to see 2. realized, 1. would be ok too > > > BTW what is a final "go" for committing the class? A common Tree class would IMHO be very welcome. I think we should go for a different approach with your myPEAR_Common stuff though. Andrei is about to contribute a function called aggregate() which basically does runtime interface import, which would be excellent for this kind of thing. The aggregate() function lets you move setOption & friends into a separate own options class and "inherit" it at runtime when needed. - Stig

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