Re: AW: [PEAR-DEV] [RfC] XML_Serializer

From: Date: Tue, 29 Jul 2003 00:07:02 +0000
Subject: Re: AW: [PEAR-DEV] [RfC] XML_Serializer
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-18859@lists.php.net to get a copy of this message
On Tue, 29 Jul 2003 01:15:29 +0200, Stephan Schmidt wrote: > Hi, >> Love it already :-) >> You have my +1 IF you remove that ugly $GLOBALS[] usage. Just >> add some class vars for the options and set them in the >> constructor or via an extra "_setOptions()" method (called by the >> constructor). Thus you can also get rid of "_adjustOptions()", >> since you can simply leave the default class-vars values. >> > I was thinking about this, but then there's no way to call the > methods statically. I see. But is that *really* important? I mean... what's wrong with: -------------- $xmlSer = new XML_Serializer($data, $options); $xmlSer->serialize(); $myXMLdata = $xmlSer->getSerializedData(); -------------- (the 2nd statemend could even be done directly within the constructor...) If you really can't do without the static call, you could create an instance of the class transparently in the serialize() method. It's ugly as well, but storing options as class vars sounds more logical to me. >> BTW... also having a matching UNserializer would be really cool... > That's not easy, as there's no type information stored in the XML > documents. Yes, I know, but what if the user helps the script passing an example of the output to it... an object istance, or an (associative) array structure... PHP can handle the type conversion by itself. IMHO It would be a killer app. Of course this is just something that came out of my numb mind and could be sth silly, so don't take it as a heavily pondered idea. I really must get some sleep, now :-) Regards, Lorenzo

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