The PHP documentation says the following about the __call()
magic method:
__call() is triggered when invoking inaccessible methods in an object context.
Is there a way I can have __call()
called even when a method exists, before the actual method is called? Or, is there some other hook I can implement or another way that would provide this functionality?
If it matters, this is for a static function
(and I would actually prefer to use __callStatic
).
How about just make all your other methods protected, and proxy them through __callStatic?
Why not just make all your methods protected and call them using __call():