public addGlobalMethod ( string $name, callable $callable ) | ||
$name | string | Name of the method |
$callable | callable | Calls your function($object, $arg1, $arg2) |
public function addGlobalMethod($name, $callable)
{
if ($this->hasMethod($name)) {
throw $this->exception('Registering method twice')->addMoreInfo('name', $name);
}
$this->addHook('global-method-' . $name, $callable);
}