function LazyString::getPrettyName
1 call to LazyString::getPrettyName()
- LazyString::fromCallable in vendor/
symfony/ string/ LazyString.php
File
-
vendor/
symfony/ string/ LazyString.php, line 120
Class
- LazyString
- A string whose value is computed lazily by a callback.
Namespace
Symfony\Component\StringCode
private static function getPrettyName(callable $callback) : string {
if (\is_string($callback)) {
return $callback;
}
if (\is_array($callback)) {
$class = \is_object($callback[0]) ? get_debug_type($callback[0]) : $callback[0];
$method = $callback[1];
}
elseif ($callback instanceof \Closure) {
$r = new \ReflectionFunction($callback);
if ($r->isAnonymous() || !($class = $r->getClosureCalledClass())) {
return $r->name;
}
$class = $class->name;
$method = $r->name;
}
else {
$class = get_debug_type($callback);
$method = '__invoke';
}
return $class . '::' . $method;
}