I would like to know if there is a way to access information when a method is called from inside a class.
Example.
Here I have a class, with a __classStatic()
method, to generate arbitrary methods.
class Caller
{
public function __callStatic($func, $args){
echo "method $func is being called from class ...";
}
}
Now, Whenever a method is called ex:Caller::foo()
inside say.. a class named Reader
,
class Reader{
Caller::foo();
}
I would like `foo() to output.
method foo is being called from class Reader
So, the problem is getting the call name from which a method is being called.
I tried inside foo() to get the class name using:
get_class()
get_parent_class()
get_called_class()
But, none of provide any information that I am looking for.