public static function focus($pattern, $backtrace, $depth = null, $maxLookup = 10)
    {
        if (!$pattern) {
            return $backtrace;
        }

        $i = 0;
        $start = 0;
        $found = false;

        while ($i < $maxLookup && isset($backtrace[$i])) {
            if (isset($backtrace[$i]['file'])) {
                $start = $start ?: $i;
                if (preg_match('~^' . $pattern . '$~', $backtrace[$i]['file'])) {
                    $found = true;
                    break;
                }
            }
            $i++;
        }
        return array_slice(array_slice($backtrace, $found ? $i : $start), 0, $depth);
    }