/**
* Determine who called Language or Text.
*
* @return array Caller information.
*
* @since 1.7.0
*/
protected function getCallerInfo()
{
// Try to determine the source if none was provided
if (!\function_exists('debug_backtrace')) {
return;
}
$backtrace = debug_backtrace();
$info = array();
// Search through the backtrace to our caller
$continue = true;
while ($continue && next($backtrace)) {
$step = current($backtrace);
$class = @$step['class'];
// We're looking for something outside of language.php
if ($class != self::class && $class != Text::class) {
$info['function'] = @$step['function'];
$info['class'] = $class;
$info['step'] = prev($backtrace);
// Determine the file and name of the file
$info['file'] = @$step['file'];
$info['line'] = @$step['line'];
$continue = false;
}
}
return $info;
}