Create an array that describes the location of the debug call

@param string $trace
@return array
976750
public function location($trace) {
        $root = substr($_SERVER['DOCUMENT_ROOT'], 0 , strlen(static::$defaults['docroot']) * -1);
        $file = implode('/', array_diff(explode('/', $trace[0]['file']), explode('/', $root)));
        $ret = array(
            'file' => $file,
            'line' => $trace[0]['line']
        );
        if (isset($trace[1]['function'])) $ret['function'] = $trace[1]['function'];
        if (isset($trace[1]['class'])) $ret['class'] = $trace[1]['class'];
        return $ret;
    }
1246888
public static function renderFromTrace( $trace )
	{
		if( !is_array( $trace ) )
			throw new InvalidArgumentException( "Trace must be an array" );
		if( !count( $trace ) )
			return '';
		$i	= 0;
		$j	= 0;
		$list	= array();
		foreach( $trace as $key => $trace )
		{
			$step	= self::renderTraceStep( $trace, $i++, $j );
			if( !$step )
				continue;
			$list[]	= UI_HTML_Tag::create( 'li', $step );
			$j++;
		}
		return UI_HTML_Tag::create( 'ol', implode( $list ), array( 'class' => 'trace' ) );
	}
521315
public function getTraceCall($trace)
    {
        $call = '';
        if(isset($trace['class'], $trace['type']))
        {
            // 匿名类必须用NULL分割一下
            list($class) = explode("\0", $trace['class']);
            $call .= $class . $trace['type'];
        }
        if(isset($trace['function']))
        {
            $call .= $trace['function'] . '(' . $this->getTraceArgs($trace) . ')';
        }
        return $call;
    }
148357
protected static function _traceToString($trace)
    {
        $loader = static::loader();

        if (!empty($trace['class'])) {
            $trace['function'] = $trace['class'] . '::' . $trace['function'] . '()';
        } else {
            $line = static::_line($trace);
            $trace['line'] = $line !== $trace['line'] ? $line . ' to ' . $trace['line'] : $trace['line'];
        }

        if (preg_match("/eval\(\)'d code/", $trace['file']) && $trace['class'] && $loader) {
            $trace['file'] = $loader->findFile($trace['class']);
        }
        return $trace['function'] .' - ' . $trace['file'] . ', line ' . $trace['line'];
    }
656671
protected function getTrace()
    {
        $backtrace = debug_backtrace();
        $index = null;
        $hasNull = false;
        $realClassName = static::__getRealClassName();
        foreach($backtrace as $i => $item)
        {
            if($realClassName === $item['class'])
            {
                $index = $i + 2;
                break;
            }
        }
        if(null === $index)
        {
            return [];
        }
        return array_splice($backtrace, $index);
    }
423001
protected function getFixtureCaller($traceIndex = 6)
    {
        $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $traceIndex + 1);
        $caller = $trace[$traceIndex];

        if (isset($caller['class'])) {
            $result = @$caller['class'] . '->' . @$caller['function'] . '()';
        } else {
            $result = @$caller['function'] . '()';
        }

        return $result;
    }
493045
public function trace()
    {
        foreach ($this->files as $file) {
            ($this->debug === true) ? $this->addTrace($file) : $this->removeTrace($file);
        }
    }
594386
public function getReplacements(): array
    {
        $replacements = [
            'blank' => '',
            'class' => $this->getClassName(),
            'message' => $this->getValue(),
        ];

        $traceReplacements = $this->getTraceReplacements();

        return array_merge($replacements, $traceReplacements);
    }
294855
private function traceHTML(array $trace) {
            ?>
            <table class="table" border="1">
                <thead>
                <tr>
                    <th>#</th>
                    <th>Method</th>
                    <th>Args</th>
                    <th>File</th>
                    <th>Line</th>
                </tr>
                </thead>
                <tbody><?php
                    foreach ($trace as $k => $v) {
                        $func = $loc = $line = '';
                        self::formatTraceLine($v, $func, $loc, $line);

                        if (isset($v['args']) && !empty($v['args'])) {
                            $args = Dump::html($v['args']);
                        } else {
                            $args = '<span class="label label-default">[none]</span>';
                        }

                        ?>
                        <tr>
                            <td><?= $k ?></td>
                            <td><?= $func ?></td>
                            <td class="text-center"><?= $args ?></td>
                            <td><?= $loc ? $loc : '<span class="label label-default">???</label>' ?></td>
                            <td><?= ($line == 0 || trim($line)) ? $line :
                                    '<span class="label label-default">???</span>' ?></td>
                        </tr>

                        <?php
                    }
                ?>
                </tbody>
            </table>
            <?php
        }
23
public static function trace($trace = null, $addObject = false)
    {
        if (!self::isDebug()) {
            return false;
        }

        $_this = self::i();

        $trace = $trace ? $trace : debug_backtrace($addObject);
        unset($trace[0]);

        $result = $_this->convertTrace($trace, $addObject);

        return $_this->dump($result, '! backtrace !');
    }
276647
private static function generateStackTrace(array &$context) {
        if (!key_exists('trace', $context)) {
            $trace = DebugHelper::fixTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), __FILE__, __LINE__);

            foreach ($trace as $i => $frame) {
                if (!isset($frame['class']) || $frame['class']!=__CLASS__)      // remove non-logger frames
                    break;
                unset($trace[$i]);
            }
            $context['trace'] = \array_values($trace);
        }
    }
155617
private function getStackTrace(MockObject $mock): array
    {
        $mockName = (new \ReflectionObject($mock))->getShortName();

        $trace = [];
        $enableTrace = false;
        foreach (debug_backtrace() as $i => $row) {
            if (isset($row['class']) && $mockName === $row['class']) {
                $enableTrace = true;
            }

            if ($enableTrace) {
                $traceRow = '';

                if (isset($row['class'])) {
                    $traceRow .= $row['class'];
                }

                if (isset($row['type'])) {
                    $traceRow .= $row['type'];
                }

                if (isset($row['function'])) {
                    $traceRow .= $row['function'];
                }

                if (isset($row['file'])) {
                    $traceRow .= sprintf(' (%s:%d)', $row['file'], $row['line']);
                }

                $trace[] = $traceRow;
            }
        }

        krsort($trace);

        return array_values($trace);
    }
33566
public static function tracePhonyCall(array $trace): array
    {
        $prefix = 'Eloquent\Phony\\';

        for ($i = count($trace) - 1; $i >= 0; --$i) {
            $entry = $trace[$i];

            if (isset($entry['class'])) {
                if (0 === strpos($entry['class'], $prefix)) {
                    return $entry;
                }
            } elseif (0 === strpos($entry['function'], $prefix)) {
                return $entry;
            }
        }

        return [];
    }
649544
protected static function _line($trace)
    {
        $path = $trace['file'];
        $callLine = $trace['line'];
        if (!file_exists($path)) {
            return;
        }
        $file = file_get_contents($path);
        if (($i = static::_findPos($file, $callLine)) === null) {
            return;
        }
        $line = $callLine;

        $brackets = 0;
        while ($i >= 0) {
            if ($file[$i] === ')') {
                $brackets--;
            } elseif ($file[$i] === '(') {
                $brackets++;
            } elseif ($file[$i] === "\n") {
                $line--;
            }
            if ($brackets > 0) {
                return $line;
            }
            $i--;
        }
    }
757065
final public function addTrace($trace) {
    Helpers::checkType('trace', 'string', $trace);
    array_splice($this->trace, 0, 0, [$trace]);
    return $this;
  }
786291
protected function getErrorDetails(\Exception $e, $trace = false)
    {
        $msg = $e->getMessage();
        if ($e instanceof DfException) {
            $context = $e->getContext();
            if (is_array($context)) {
                $context = print_r($context, true);
            }
            if (!empty($context)) {
                $msg .= "\nContext: " . $context;
            }
        }

        if ($trace === true) {
            $msg .= "\nTrace:\n" . $e->getTraceAsString();
        }

        return $msg;
    }
606894
public function debugInfo()
    {
        return [
            'exists' => $this->exists(),
            'isFile' => $this->isFile(),
            'isImage' => $this->isImage(),
            'path' => $this->path,
            'lastModified' => $this->lastModified,
            'name' => $this->name,
            'dir' => $this->dir,
            'mimeType' => $this->mimeType,
            'extension' => $this->extension,
            'size' => $this->size,
            'type' => $this->type,
            'getFullName' => $this->getFullName()
        ];
    }