Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LazyString.php

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\String

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal