Added a ClosureTask implementation for easier task scheduling (#2497)

This commit is contained in:
Dylan T
2018-11-04 22:55:40 +00:00
committed by GitHub
parent 3dabf90b0e
commit 755db3dac8
2 changed files with 71 additions and 0 deletions

View File

@ -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.
*