RealisticDummyContentException.php in Realistic Dummy Content 8.2
File
api/src/includes/RealisticDummyContentException.php
View source
<?php
namespace Drupal\realistic_dummy_content_api\includes;
use Drupal\realistic_dummy_content_api\Framework\Framework;
define('REALISTIC_DUMMY_CONTENT_API_EXCEPTION_BACKTRACE_LEVEL', 4);
class RealisticDummyContentException extends \Exception {
public function __construct($message) {
parent::__construct($message);
$this
->log();
}
public function log() {
Framework::instance()
->debug($this
->getMessage() . ' (' . $this
->getCaller() . ' called ' . $this
->getCalled() . ')');
}
public static function getCaller() {
$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;
}
public static function getCalled() {
return self::getCaller();
}
}