If you’ve ever tried to subclass a PHP4 static class you may have come to same conclusion that I have its a total pain in the neck. However, I think I’ve come up with a not too terrible approach.
Basically the first time you call
getInstance() you can specify a different name to store as the instance. And yes this can lead to people busting up your class and breaking their application. However, it also means you can effectively test the class as well. Which to me is a big advantage, and negates the possible stupid user factor.
Before any one asks what FireCake is. I’ve begun working on an implementation of the FirePHP library for CakePHP. It will ship with the DebugKit when complete. And there will be a FirePHP helper included as well, so when making non HTML requests all your debug toolbar information will be available in Firebug.