Merge branch 'release/3.3' into release/3.4

This commit is contained in:
Dylan K. Taylor
2018-10-31 18:55:26 +00:00
3 changed files with 24 additions and 1 deletions

View File

@ -52,6 +52,23 @@ class Utils{
}
}
/**
* Returns a readable identifier for the class of the given object. Sanitizes class names for closures.
*
* @param object $obj
*
* @return string
* @throws \ReflectionException
*/
public static function getNiceClassName(object $obj) : string{
$reflect = new \ReflectionClass($obj);
if($reflect->isAnonymous()){
return "anonymous@" . self::cleanPath($reflect->getFileName()) . "#L" . $reflect->getStartLine();
}
return $reflect->getName();
}
/**
* Gets this machine / server instance unique ID
* Returns a hash, the first 32 characters (or 16 if raw)