Completed
Pull Request — master (#526)
by Michael
11:09 queued 01:05
created

DebugHelper   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 10
c 0
b 0
f 0
ccs 2
cts 4
cp 0.5
wmc 5
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getBacktrace() 0 26 5
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