function public static function Unicode::convertCallback

8.x-3.x Unicode.php public static Unicode::convertCallback($callback, $array = FALSE)

Converts a callback to a string representation.

Parameters

array|string $callback: The callback to convert.

bool $array: Flag determining whether or not to convert the callback to an array.

Return value

string The converted callback as a string or an array if $array is specified.

Class

Unicode
Extends \Drupal\Component\Utility\Unicode.

Namespace

Drupal\bootstrap\Utility

Source src/Utility/Unicode.php (line 77)

public static function convertCallback($callback, $array = FALSE) {
  if (is_array($callback)) {
    if (is_object($callback[0])) {
      $callback[0] = get_class($callback[0]);
    }
    $callback = implode('::', $callback);
  }
  if ($callback[0] === '\\') {
    $callback = static::substr($callback, 1);
  }
  if ($array && static::strpos($callback, '::') !== FALSE) {
    $callback = explode('::', $callback);
  }
  return $callback;
}