src/includes/classes/Core/Utils/Backtrace.php
public function callers(int $at = null, bool $all = false, $___offset = 0): array
    {
        $callers = []; // Initialize.

        // `[0]` is the call to this function.
        // So we start searching from offset index `1`.
        // An additional `$___offset` location is added to this.
        // And then an additional `$at` location can be added also.

        // @TODO Use the limit parameter to `debug_backtrace()` as a way
        // of further optimizing this routine. No need to pull everything at all times.

        if (!($backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS))) {
            return $callers; // Not possible; unexpected trace.
        }
        for ($_i = 1 + $___offset + $at; $_i < count($backtrace); ++$_i) {
            $_caller   = $backtrace[$_i];
            $_function = $_caller['function'] ?? '';
            $_class    = $_caller['class'] ?? '';
            $_type     = $_caller['type'] ?? '';

            if (!$all) { // If not `$all`, exclude magicals, facades, and other middle-men.
                if ($_class && mb_strpos($_function, '__') === 0 && isset($_function[2]) && $_function[2] !== '_') {
                    continue; // Bypass magic (middle-man) methods in classes.
                    //
                } elseif ($_class && $_type === '::' && mb_stripos($_class, '\\Facades') !== false) {
                    continue; // Bypass facades that sit in the middle also.
                    //
                } elseif ($_class && mb_strtolower($_class) === 'wp_hook') {
                    continue; // Bypass everything in `WP_Hook` class.
                    //
                } elseif (!$_class) { // A few others.
                    $_lc_function = mb_strtolower($_function);

                    if (in_array($_lc_function, ['call_user_func', 'call_user_func_array'], true)) {
                        continue; // Bypass these also.
                    } elseif (in_array($_lc_function, ['do_action', 'apply_filters'], true)) {
                        continue; // Bypass these also.
                    }
                } // This covers WordPress and the WP Sharks Core also.
            }
            $callers[] = ($_class && $_type ? $_class.$_type : '').$_function;
            // e.g., `a->method`, `b::method`, `function`, `__`, etc.
        } // unset($_caller, $_function, $_lc_function, $_class, $_type); // Housekeeping.

        return $callers;
    }
public function callers(int $at = null, bool $all = false, $___offset = 0): array
    {
        $callers = []; // Initialize.

        // `[0]` is the call to this function.
        // So we start searching from offset index `1`.
        // An additional `$___offset` location is added to this.
        // And then an additional `$at` location can be added also.

        // @TODO Use the limit parameter to `debug_backtrace()` as a way
        // of further optimizing this routine. No need to pull everything at all times.

        if (!($backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS))) {
            return $callers; // Not possible; unexpected trace.
        }
        for ($_i = 1 + $___offset + $at; $_i < count($backtrace); ++$_i) {
            $_caller   = $backtrace[$_i];
            $_function = $_caller['function'] ?? '';
            $_class    = $_caller['class'] ?? '';
            $_type     = $_caller['type'] ?? '';

            if (!$all) { // If not `$all`, exclude magicals, facades, and other middle-men.
                if ($_class && mb_strpos($_function, '__') === 0 && isset($_function[2]) && $_function[2] !== '_') {
                    continue; // Bypass magic (middle-man) methods in classes.
                    //
                } elseif ($_class && $_type === '::' && mb_stripos($_class, '\\Facades') !== false) {
                    continue; // Bypass facades that sit in the middle also.
                    //
                } elseif ($_class && mb_strtolower($_class) === 'wp_hook') {
                    continue; // Bypass everything in `WP_Hook` class.
                    //
                } elseif (!$_class) { // A few others.
                    $_lc_function = mb_strtolower($_function);

                    if (in_array($_lc_function, ['call_user_func', 'call_user_func_array'], true)) {
                        continue; // Bypass these also.
                    } elseif (in_array($_lc_function, ['do_action', 'apply_filters'], true)) {
                        continue; // Bypass these also.
                    }
                } // This covers WordPress and the WP Sharks Core also.
            }
            $callers[] = ($_class && $_type ? $_class.$_type : '').$_function;
            // e.g., `a->method`, `b::method`, `function`, `__`, etc.
        } // unset($_caller, $_function, $_lc_function, $_class, $_type); // Housekeeping.

        return $callers;
    }
Get backtrace callers.

@since 170211.63148 Debugging utilities.

@param int|null $at        Starting at position.
@param bool     $all       Include magic middle-men?
@param int      $___offset For internal use only.

@return array Backtrace callers.