I've been working on my own little framework for a while for my own benefit, constantly going back over the code as I learn new stuff. As you might expect, I have a Registry object that's used by pretty much every other object.
At present, the most basic object (AFObject) is set up a little like this
absract class AFObject {
var $_registry;
function __construct(){
$this->_registry = AFRegistry::getInstance();
}
}
So every object will now contain a local reference to the Registry. So if I have hundreds of objects instantiated at 1 time, that's hundreds of references to the singleton. But would it be more or less efficient to always refer to the Registry directly like this...
class AFRouter extends AFObject {
function someMethod( $bar ){
AFRegistry::$foo = $bar;
}
}