You are here

static function xautoload_Util::callbackToString in X Autoload 7.3

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 xautoload_Util::callbackToString()
_xautoload_test_1_early_boot_observations in tests/test_1/xautoload_test_1.module
Test the current state, and remember it.
_xautoload_test_2_early_boot_observations in tests/test_2/xautoload_test_2.module
Test the current state, and remember it.

File

lib/Util.php, line 85

Class

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

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