So, I have a hosting service that refuses to upgrade to PHP 5.3 (which is annoying, but great at the same time, I am flexible), but the only thing that really sets me apart is the lack of an affordable __callStatic.
I have loaded the modules that I want to consolidate to one class (i.e., have a class that loads the modules and then accesses the functions of these modules through calls to the __callStatic main class method), but when I load from the local testing server to my server , obviously the __callStatic method does not work.
Is there an alternative that is still static? I like clean code looking for a double colon (i.e. registry::some_func()) instead $registry->some_func().
Another side of this is that now I have to use the keyword globalin functions (which, according to my own preferences, is very, very dirty).
This code was also extremely fast, using static methods instead of non-static methods, and in turn, much cleaner.
Also: I thought about writing the __callStatic method, as usual, with 5.2, and then explicitly calling the methods, for example registry::__callStatic("some_func"), array("val", "val2", "val3"), and simplifies the process this way, even being easier to carry over when upgrading to 5.3. Thoughts on this method?
Thank!
source
share