Re: Some changes in the Config package
| From: | Alan Knowles | Date: | Sat, 23 Nov 2002 00:21:33 +0000 |
| Subject: | Re: Some changes in the Config package | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-11025@lists.php.net to get a copy of this message | ||
Bertrand Mansion wrote:
Hi, Here are the changes I plan to make for the next release of Config. This is some kind of a reminder for me not to forget what I am thinking about right now as I won't have the time to do it before next month... The Config_Container class should not be subclassed as it is now. Config_Container_Apache should not subclass Config_Container. This was an adaptation from the previous package version but now, I think it's the wrong design. In fact, we just need the toString() method. I plan to adapt it to a separate function instead of a class method. So the file /Config/Container/apache.php will still exist and contain this function. The parser methods will extend the Config object. Actually, this is more logical as the Config object parses the file only once, I don't see why this method would be needed by a Container object. On the other hand, we still need a toString() method in the Container object in case one want to get the Container as a formatted string. But this time, it will call the toString() function from the outside. I think it will call something like toString($this) and return the result.I'm gessing this is what you are after.. - either that or I missed something.. class xxx_container { .... function toString() {
xxx_writer::toString();} } using the static method call to provide 'sudo' aggregation. (as $this), gets passed around automatically. Regards Alan
This move will allow to treat the Container as a simple tree that could be shared among different Config objects. This way, one would be able to parse an .ini file and write it as a PHP array or anything else by passing its root container to another Config object. I don't know yet how I will implement this. I wonder if object aggregation could help ? Do you know since which version aggregation exists in PHP and if it is compiled by default on all platforms ? Thanks, Bertrand Mansion Mamasam