Completed
Pull Request — master (#526)
by Michael
16:45 queued 06:57
created

DebugHelper::getBacktrace()   A

Complexity

Conditions 5
Paths 4

Size

Total Lines 26
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 30

Importance

Changes 1
Bugs 1 Features 1
Metric Value
cc 5
eloc 14
nc 4
nop 0
dl 0
loc 26
ccs 0
cts 19
cp 0
crap 30
rs 9.4888
c 1
b 1
f 1
1
<?php
2
3
/**
4
 * DebugHelper short summary.
5
 *
6
 * DebugHelper description.
7
 *
8
 * @version 1.0
9
 * @author stwalkerster
10
 */
11
class DebugHelper
12
{
13
	public static function getBacktrace()
14
	{
15
		$backtrace = debug_backtrace();
16
        
17
		$output = "";
18
        
19
		$count = 0;
20
		foreach ($backtrace as $line) {
21
			if ($count == 0) {
22
				$count++;
23
				continue;
24
			}
25
            
26
			$output .= "#{$count}: ";
27
            
28
			if (isset($line['type']) && $line['type'] != "") {
29
				$output .= $line['class'] . $line['type'];
30
			}
31
            
32
			$output .= $line['function'] . "(...)";
33
			$output .= " [{$line['file']}#{$line['line']}\r\n";
34
            
35
			$count++;
36
		}
37
        
38
		return $output;
39
	}
40
}
41