Design question / PHP: I have a class with methods. I would like to call to an external function anytime when any of the methods within the class is called. I would like to make it generic so anytime I add another method, the flow works with this method too.
Simplified example:
<?php
function foo()
{
return true;
}
class ABC {
public function a()
{
echo 'a';
}
public function b()
{
echo 'b';
}
}
?>
I need to call to foo() before a() or b() anytime are called.
How can I achieve this?
constructorin aclass__calland__callStaticto intercept any method call and execute your function before doing the real call.