You are here

static function Util::callbackToString in X Autoload 7.4

Same name and namespace in other branches
  1. 7.5 src/Util.php \Drupal\xautoload\Util::callbackToString()

Get a string representation of a callback for debug purposes.

Parameters

callback $callback: A PHP callback, which could be an array or a string.

Return value

string A string representation to be displayed to a user, e.g. "Foo::staticMethod()", or "Foo->bar()"

2 calls to Util::callbackToString()
EnvironmentSnapshotMaker::buildSnapshot in lib/Drupal/xautoload/Tests/EnvironmentSnapshotMaker.php
XAutoloadUnitTestCase::testAutoloadStackOrder in lib/Drupal/xautoload/Tests/XAutoloadUnitTestCase.php

File

lib/Util.php, line 96

Class

Util
A number of static methods that don't interact with any global state.

Namespace

Drupal\xautoload

Code

static function callbackToString($callback) {
  if (is_array($callback)) {
    list($obj, $method) = $callback;
    if (is_object($obj)) {
      $str = get_class($obj) . '->' . $method . '()';
    }
    else {
      $str = $obj . '::';
      $str .= $method . '()';
    }
  }
  else {
    $str = $callback;
  }
  return $str;
}