mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Added a ClosureTask implementation for easier task scheduling (#2497)
This commit is contained in:
@ -52,6 +52,19 @@ class Utils{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a readable identifier for the given Closure, including file and line.
|
||||
*
|
||||
* @param \Closure $closure
|
||||
*
|
||||
* @return string
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public static function getNiceClosureName(\Closure $closure) : string{
|
||||
$func = new \ReflectionFunction($closure);
|
||||
return "closure@" . self::cleanPath($func->getFileName()) . "#L" . $func->getStartLine();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a readable identifier for the class of the given object. Sanitizes class names for anonymous classes.
|
||||
*
|
||||
|
Reference in New Issue
Block a user