mageekguy\atoum\scripts\treemap\analyzer\generic: lines coverage

100% of 107

OPs

100% of 15

Lines

92% of 12

Branches

100% of 9

Paths
Method OPs OPs % Lines Line % Branches Branches % Paths Path %
mageekguy\atoum\scripts\treemap\analyzer\generic::__construct() 22 100% 5 100% 1 0% 1 100%
mageekguy\atoum\scripts\treemap\analyzer\generic::setCallback() 12 100% 2 100% 1 100% 1 100%
mageekguy\atoum\scripts\treemap\analyzer\generic::getCallback() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\scripts\treemap\analyzer\generic::setMetricName() 21 100% 2 100% 1 100% 1 100%
mageekguy\atoum\scripts\treemap\analyzer\generic::getMetricName() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\scripts\treemap\analyzer\generic::setMetricLabel() 20 100% 2 100% 5 100% 2 100%
mageekguy\atoum\scripts\treemap\analyzer\generic::getMetricLabel() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\scripts\treemap\analyzer\generic::getMetricFromFile() 14 100% 1 100% 1 100% 1 100%
#
1
<?php
2

                    
3
namespace mageekguy\atoum\scripts\treemap\analyzer;
4

                    
5
use
6
	mageekguy\atoum\scripts\treemap\analyzer
7
;
8

                    
9
class generic implements analyzer
10
{
11
	protected $metricName = '';
12
	protected $metricLabel = '';
13
	protected $callback = null;
14

                    
15
	public function __construct($metricName, $metricLabel = null, $callback = null)100%
16
	{
17
		$this
18
			->setCallback($callback)
19
			->setMetricName($metricName)
20
			->setMetricLabel($metricLabel)
21
		;
22
	}
23

                    
24
	public function setCallback(\closure $callback = null)100%
25
	{
26
		$this->callback = $callback ?: function() { return 0; };
27

                    
28
		return $this;
29
	}
30

                    
31
	public function getCallback()100%
32
	{
33
		return $this->callback;
34
	}
35

                    
36
	public function setMetricName($metricName)100%
37
	{
38
		$this->metricName = (string) $metricName;
39

                    
40
		return $this->setMetricLabel(ucfirst($this->metricName));
41
	}
42

                    
43
	public function getMetricName()100%
44
	{
45
		return $this->metricName;
46
	}
47

                    
48
	public function setMetricLabel($metricLabel = null)100%
49
	{
50
		$this->metricLabel = ($metricLabel ? (string) $metricLabel : ucfirst($this->metricName));
51

                    
52
		return $this;
53
	}
54

                    
55
	public function getMetricLabel()100%
56
	{
57
		return $this->metricLabel;
58
	}
59

                    
60
	public function getMetricFromFile(\splFileInfo $file)100%
61
	{
62
		return call_user_func_array($this->callback, array($file));
63
	}
64
}