Could this code be made a little less verbose? On the one hand, it would be nice if you could add a few more comments and on the other hand, you could simply check if $params is an object of type JRegistry (as long as we don't have an interface for this) and then you could pull in the 3 if statements into one...