Ok, here is tonights installment. I've added a singleton capabilty.
You can fetch a singleton with the property notation.
This is equivelent to
$value = $registry->className
except that it will always return the same object in subsequent calls.
$value = $registry->className();
You can also set values
If it is necessary to inject a value and a singleton is available, the singleton will be injected. Otherwise, a new instance will be created (as in the last version). This newly created instance will not become a singleton. Is this the best behavior?
$registry->foo = new StdClass();
$registry->bar = "any data";
I ran into what appears to be a SimpleTest bug in testing this. The following assertion fails.
Here is the current code:
$this->assertNotIdentical(new StdClass(), new StdClass());
Next, I think __call is getting to be a bit complicated. I think some refactoring may be in order.