You are here

static function RealisticDummyContentException::GetCaller in Realistic Dummy Content 7

Returns the calling function through a backtrace

2 calls to RealisticDummyContentException::GetCaller()
RealisticDummyContentException::GetCalled in api/includes/RealisticDummyContentException.inc
Returns the called function through a backtrace
RealisticDummyContentException::Log in api/includes/RealisticDummyContentException.inc

File

api/includes/RealisticDummyContentException.inc, line 33
Define RealisticDummyContentException autoload class.

Class

RealisticDummyContentException
An Exception.

Code

static function GetCaller() {

  // a funciton x has called a function y which called this
  // see stackoverflow.com/questions/190421
  $caller = debug_backtrace();
  $caller = $caller[REALISTIC_DUMMY_CONTENT_EXCEPTION_BACKTRACE_LEVEL];
  $r = $caller['function'] . '()';
  if (isset($caller['class'])) {
    $r .= ' in ' . $caller['class'];
  }
  if (isset($caller['object'])) {
    $r .= ' (' . get_class($caller['object']) . ')';
  }
  return $r;
}