You can use the third parameter is_callable to get the called name , which is a string.
If the called is array('MyClass', 'myCallbackMethod'), then the called name will be 'MyClass::myCallbackMethod'.
function addCallable(callable $cb)
{
is_callable($cb, true, $callable_name);
if(isset($this->collection[$callable_name])) {
throw new Exception("Callable was already added to the collection");
} else {
$this->collection[$callable_name] = $cb;
}
}
function removeCallable(callable $cb)
{
is_callable($cb, true, $callable_name);
unset($this->collection[$callable_nam]);
}
source
share