src/ErrorHandler/ErrorHandler.php
protected function normalizeTrace($backtrace)
    {
        $backtraceNew = array();
        $frameDefault = array(
            'file' => null,
            'line' => null,
            'function' => null,
            'class' => null,
            'type' => null,
        );
        $funcsSkip = array('call_user_func','call_user_func_array');
        $funcsSkipRegex = '/^('.\implode('|', $funcsSkip).')[:\(\{]/';
        for ($i = 0, $count=\count($backtrace); $i < $count; $i++) {
            $frame = \array_merge($frameDefault, $backtrace[$i]);
            $frame = \array_intersect_key($frame, $frameDefault);
            if (\in_array($frame['function'], $funcsSkip) || \preg_match($funcsSkipRegex, $frame['function'])) {
                $backtraceNew[count($backtraceNew) - 1]['file'] = $frame['file'];
                $backtraceNew[count($backtraceNew) - 1]['line'] = $frame['line'];
                continue;
            }
            if (\in_array($frame['type'], array('dynamic','static'))) {
                // xdebug_get_function_stack
                $frame['type'] = $frame['type'] === 'dynamic' ? '->' : '::';
            }
            if (isset($backtrace[$i]['include_filename'])) {
                // xdebug_get_function_stack
                $frame['function'] = 'include or require';
            } else {
                $frame['function'] = \preg_match('/\{closure\}$/', $frame['function'])
                    ? $frame['function']
                    : $frame['class'].$frame['type'].$frame['function'];
            }
            if (!$frame['function']) {
                unset($frame['function']);
            }
            unset($frame['class'], $frame['type']);
            $backtraceNew[] = $frame;
        }
        return $backtraceNew;
    }
protected function normalizeTrace($backtrace)
    {
        $backtraceNew = array();
        $frameDefault = array(
            'file' => null,
            'line' => null,
            'function' => null,
            'class' => null,
            'type' => null,
        );
        $funcsSkip = array('call_user_func','call_user_func_array');
        $funcsSkipRegex = '/^('.\implode('|', $funcsSkip).')[:\(\{]/';
        for ($i = 0, $count=\count($backtrace); $i < $count; $i++) {
            $frame = \array_merge($frameDefault, $backtrace[$i]);
            $frame = \array_intersect_key($frame, $frameDefault);
            if (\in_array($frame['function'], $funcsSkip) || \preg_match($funcsSkipRegex, $frame['function'])) {
                $backtraceNew[count($backtraceNew) - 1]['file'] = $frame['file'];
                $backtraceNew[count($backtraceNew) - 1]['line'] = $frame['line'];
                continue;
            }
            if (\in_array($frame['type'], array('dynamic','static'))) {
                // xdebug_get_function_stack
                $frame['type'] = $frame['type'] === 'dynamic' ? '->' : '::';
            }
            if (isset($backtrace[$i]['include_filename'])) {
                // xdebug_get_function_stack
                $frame['function'] = 'include or require';
            } else {
                $frame['function'] = \preg_match('/\{closure\}$/', $frame['function'])
                    ? $frame['function']
                    : $frame['class'].$frame['type'].$frame['function'];
            }
            if (!$frame['function']) {
                unset($frame['function']);
            }
            unset($frame['class'], $frame['type']);
            $backtraceNew[] = $frame;
        }
        return $backtraceNew;
    }
protected function normalizeTrace ( $ backtrace ) { $ backtraceNew = array ( ) ; $ frameDefault = array ( 'file' => null , 'line' => null , 'function' => null , 'class' => null , 'type' => null , ) ; $ funcsSkip = array ( 'call_user_func' , 'call_user_func_array' ) ; $ funcsSkipRegex = '/^(' . \ implode ( '|' , $ funcsSkip ) . ')[:\(\{]/' ; for ( $ i = 0 , $ count = \ count ( $ backtrace ) ; $ i < $ count ; $ i ++ ) { $ frame = \ array_merge ( $ frameDefault , $ backtrace [ $ i ] ) ; $ frame = \ array_intersect_key ( $ frame , $ frameDefault ) ; if ( \ in_array ( $ frame [ 'function' ] , $ funcsSkip ) || \ preg_match ( $ funcsSkipRegex , $ frame [ 'function' ] ) ) { $ backtraceNew [ count ( $ backtraceNew ) - 1 ] [ 'file' ] = $ frame [ 'file' ] ; $ backtraceNew [ count ( $ backtraceNew ) - 1 ] [ 'line' ] = $ frame [ 'line' ] ; continue ; } if ( \ in_array ( $ frame [ 'type' ] , array ( 'dynamic' , 'static' ) ) ) { // xdebug_get_function_stack $ frame [ 'type' ] = $ frame [ 'type' ] === 'dynamic' ? '->' : '::' ; } if ( isset ( $ backtrace [ $ i ] [ 'include_filename' ] ) ) { // xdebug_get_function_stack $ frame [ 'function' ] = 'include or require' ; } else { $ frame [ 'function' ] = \ preg_match ( '/\{closure\}$/' , $ frame [ 'function' ] ) ? $ frame [ 'function' ] : $ frame [ 'class' ] . $ frame [ 'type' ] . $ frame [ 'function' ] ; } if ( ! $ frame [ 'function' ] ) { unset ( $ frame [ 'function' ] ) ; } unset ( $ frame [ 'class' ] , $ frame [ 'type' ] ) ; $ backtraceNew [ ] = $ frame ; } return $ backtraceNew ; }
"Normalize" backtrace from debug_backtrace() or xdebug_get_function_stack();

@param array $backtrace trace/stack from debug_backtrace() or xdebug_Get_function_stack()

@return array
Normalize backtrace from debug_backtrace () or xdebug_get_function_stack () ;