protected static function formatBacktrace(array $backtrace) : array
    {
        if (is_array($backtrace) === false || count($backtrace) === 0) {
            return $backtrace;
        }

        /**
         * Remove unnecessary info from backtrace
         */
        if ($backtrace[0]['function'] == '{closure}') {
            unset($backtrace[0]);
        }

        /**
         * Format backtrace
         */
        $trace = [];

        foreach ($backtrace as $entry) {

            /**
             * Function
             */
            $function = '';

            if (isset($entry['class'])) {
                $function .= $entry['class'] . $entry['type'];
            }

            $function .= $entry['function'] . '()';

            /**
             * Arguments
             */
            $arguments = [];

            if (isset($entry['args']) && count($entry['args']) > 0) {
                foreach ($entry['args'] as $arg) {
                    ob_start();

                    var_dump($arg);

                    $arg = htmlspecialchars(ob_get_contents());

                    ob_end_clean();

                    $arguments[] = $arg;
                }
            }

            /**
             * Location
             */
            $location = [];

            if (isset($entry['file'])) {
                $location['file'] = $entry['file'];
                $location['line'] = $entry['line'];
                $location['code'] = self::highlightCode($entry['file'], $entry['line']);
            }

            /**
             * Compile into array
             */
            $trace[] = array
            (
                'function'  => $function,
                'arguments' => $arguments,
                'location'  => $location,
            );
        }

        return $trace;
    }
protected static function formatBacktrace(array $backtrace) : array
    {
        if (is_array($backtrace) === false || count($backtrace) === 0) {
            return $backtrace;
        }

        /**
         * Remove unnecessary info from backtrace
         */
        if ($backtrace[0]['function'] == '{closure}') {
            unset($backtrace[0]);
        }

        /**
         * Format backtrace
         */
        $trace = [];

        foreach ($backtrace as $entry) {

            /**
             * Function
             */
            $function = '';

            if (isset($entry['class'])) {
                $function .= $entry['class'] . $entry['type'];
            }

            $function .= $entry['function'] . '()';

            /**
             * Arguments
             */
            $arguments = [];

            if (isset($entry['args']) && count($entry['args']) > 0) {
                foreach ($entry['args'] as $arg) {
                    ob_start();

                    var_dump($arg);

                    $arg = htmlspecialchars(ob_get_contents());

                    ob_end_clean();

                    $arguments[] = $arg;
                }
            }

            /**
             * Location
             */
            $location = [];

            if (isset($entry['file'])) {
                $location['file'] = $entry['file'];
                $location['line'] = $entry['line'];
                $location['code'] = self::highlightCode($entry['file'], $entry['line']);
            }

            /**
             * Compile into array
             */
            $trace[] = array
            (
                'function'  => $function,
                'arguments' => $arguments,
                'location'  => $location,
            );
        }

        return $trace;
    }
protected static function formatBacktrace ( array $ backtrace ) : array { if ( is_array ( $ backtrace ) === false || count ( $ backtrace ) === 0 ) { return $ backtrace ; } /**
         * Remove unnecessary info from backtrace
         */ if ( $ backtrace [ 0 ] [ 'function' ] == '{closure}' ) { unset ( $ backtrace [ 0 ] ) ; } /**
         * Format backtrace
         */ $ trace = [ ] ; foreach ( $ backtrace as $ entry ) { /**
             * Function
             */ $ function = '' ; if ( isset ( $ entry [ 'class' ] ) ) { $ function .= $ entry [ 'class' ] . $ entry [ 'type' ] ; } $ function .= $ entry [ 'function' ] . '()' ; /**
             * Arguments
             */ $ arguments = [ ] ; if ( isset ( $ entry [ 'args' ] ) && count ( $ entry [ 'args' ] ) > 0 ) { foreach ( $ entry [ 'args' ] as $ arg ) { ob_start ( ) ; var_dump ( $ arg ) ; $ arg = htmlspecialchars ( ob_get_contents ( ) ) ; ob_end_clean ( ) ; $ arguments [ ] = $ arg ; } } /**
             * Location
             */ $ location = [ ] ; if ( isset ( $ entry [ 'file' ] ) ) { $ location [ 'file' ] = $ entry [ 'file' ] ; $ location [ 'line' ] = $ entry [ 'line' ] ; $ location [ 'code' ] = self :: highlightCode ( $ entry [ 'file' ] , $ entry [ 'line' ] ) ; } /**
             * Compile into array
             */ $ trace [ ] = array ( 'function' => $ function , 'arguments' => $ arguments , 'location' => $ location , ) ; } return $ trace ; }
Modifies the backtrace array.

@param  array $backtrace Array returned by the getTrace() method of an exception object
@return array
Modifies the backtrace array .