public static function getCallStack($asArray = false)
    {
        $i = 0;
        $resp = [];

        if (!$asArray) {
            $resp[] = str_repeat('=', 50);
        }

        foreach (debug_backtrace() as $node) {
            $file = Arr::get($node, 'file', '');
            $file = $file ?: 'no_file';

            $fn = $node['function'];
            $line = Arr::get($node, 'line', -1);

            $i = $asArray ? '' : "$i.";

            $resp[] = $i.$file.':'.$fn.' '.$line;
            ++$i;
        }

        return $asArray ? $resp : implode("\n", $resp);
    }
public static function getCallStack($asArray = false)
    {
        $i = 0;
        $resp = [];

        if (!$asArray) {
            $resp[] = str_repeat('=', 50);
        }

        foreach (debug_backtrace() as $node) {
            $file = Arr::get($node, 'file', '');
            $file = $file ?: 'no_file';

            $fn = $node['function'];
            $line = Arr::get($node, 'line', -1);

            $i = $asArray ? '' : "$i.";

            $resp[] = $i.$file.':'.$fn.' '.$line;
            ++$i;
        }

        return $asArray ? $resp : implode("\n", $resp);
    }
public static function getCallStack ( $ asArray = false ) { $ i = 0 ; $ resp = [ ] ; if ( ! $ asArray ) { $ resp [ ] = str_repeat ( '=' , 50 ) ; } foreach ( debug_backtrace ( ) as $ node ) { $ file = Arr :: get ( $ node , 'file' , '' ) ; $ file = $ file ? : 'no_file' ; $ fn = $ node [ 'function' ] ; $ line = Arr :: get ( $ node , 'line' , - 1 ) ; $ i = $ asArray ? '' : "$i." ; $ resp [ ] = $ i . $ file . ':' . $ fn . ' ' . $ line ; ++ $ i ; } return $ asArray ? $ resp : implode ( "\n" , $ resp ) ; }
Prints stack trace.

@param bool $asArray

@return string
Prints stack trace .