You are here

public static function RealisticDummyContentException::getCaller in Realistic Dummy Content 3.x

Same name and namespace in other branches
  1. 8.2 api/src/includes/RealisticDummyContentException.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentException::getCaller()
  2. 7.2 api/src/includes/RealisticDummyContentException.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentException::getCaller()

Returns the calling function through a backtrace.

2 calls to RealisticDummyContentException::getCaller()
RealisticDummyContentException::getCalled in api/src/includes/RealisticDummyContentException.php
Returns the called function through a backtrace.
RealisticDummyContentException::log in api/src/includes/RealisticDummyContentException.php
Logs a message.

File

api/src/includes/RealisticDummyContentException.php, line 36

Class

RealisticDummyContentException
An Exception.

Namespace

Drupal\realistic_dummy_content_api\includes

Code

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