On 11/7/11 11:16 AM, Mac Newbold wrote: > The idea of using static class methods kind of appeals to me, so I can > use Conf::url() anywhere without having to pass around variables or > instantiate a Config class all over. Using a magic method like > __call() the Conf class could even be set up so that it returns the > value of the corresponding class variable when an unknown function is > called, so you wouldn't have to set up a function for every config > variable you wanted to be able to retrieve.
I like this approach, but there are some negatives. First, you're calling a dynamic function every time you need a config variable. Depending on how much you do this, it has the potential to slow down your code, so just be aware of the tradeoff. Second, and more importantly, it doesn't work: "Property overloading only works in object context. These magic methods will not be triggered in static context." I wish there was a way to declare a property to be publicly read-only. Public, private, and protected are not good enough in some cases. Steve _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
