You are here

function realistic_dummy_content_api_calling_function in Realistic Dummy Content 7.2

Same name and namespace in other branches
  1. 8.2 api/realistic_dummy_content_api.module \realistic_dummy_content_api_calling_function()
  2. 3.x api/realistic_dummy_content_api.module \realistic_dummy_content_api_calling_function()

Returns the calling function through a backtrace.

1 call to realistic_dummy_content_api_calling_function()
realistic_dummy_content_api_argcheck in api/realistic_dummy_content_api.module
Check arguments' types.

File

api/realistic_dummy_content_api.module, line 85
API code allowing other modules to generate realistic dummy content.

Code

function realistic_dummy_content_api_calling_function($level = 2) {

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