mageekguy\atoum\report: lines coverage

90% of 177

OPs

100% of 37

Lines

79% of 28

Branches

75% of 20

Paths
Method OPs OPs % Lines Line % Branches Branches % Paths Path %
mageekguy\atoum\report::__construct() 12 100% 4 100% 1 0% 1 100%
mageekguy\atoum\report::__toString() 17 71% 5 100% 6 67% 3 33%
mageekguy\atoum\report::setLocale() 16 100% 2 100% 1 100% 1 100%
mageekguy\atoum\report::getLocale() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\report::setAdapter() 16 100% 3 100% 1 100% 1 100%
mageekguy\atoum\report::getAdapter() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\report::setTitle() 10 100% 3 100% 1 100% 1 100%
mageekguy\atoum\report::getTitle() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\report::addField() 16 100% 2 100% 1 100% 1 100%
mageekguy\atoum\report::resetFields() 9 100% 2 100% 1 100% 1 100%
mageekguy\atoum\report::getFields() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\report::getWriters() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\report::handleEvent() 34 65% 8 100% 9 67% 4 25%
mageekguy\atoum\report::isOverridableBy() 7 100% 1 100% 1 100% 1 100%
mageekguy\atoum\report::doAddWriter() 10 100% 2 100% 1 100% 1 100%
#
1
<?php
2

                    
3
namespace mageekguy\atoum;
4

                    
5
class report implements observer
6
{
7
	protected $locale = null;
8
	protected $adapter = null;
9
	protected $title = null;
10
	protected $writers = array();
11
	protected $fields = array();
12
	protected $lastSetFields = array();
13

                    
14
	public function __construct()100%
15
	{
16
		$this
17
			->setLocale()
18
			->setAdapter()
19
		;
20
	}
21

                    
22
	public function __toString()100%
23
	{
24
		$string = '';
25

                    
26
		foreach ($this->lastSetFields as $field)
27
		{
28
			$string .= $field;
29
		}
30

                    
31
		return $string;
32
	}
33

                    
34
	public function setLocale(locale $locale = null)100%
35
	{
36
		$this->locale = $locale ?: new locale();
37

                    
38
		return $this;
39
	}
40

                    
41
	public function getLocale()100%
42
	{
43
		return $this->locale;
44
	}
45

                    
46
	public function setAdapter(adapter $adapter = null)
47
	{
48
		$this->adapter = $adapter ?: new adapter();
49

                    
50
		return $this;
51
	}
52

                    
53
	public function getAdapter()100%
54
	{
55
		return $this->adapter;
56
	}
57

                    
58
	public function setTitle($title)100%
59
	{
60
		$this->title = (string) $title;
61

                    
62
		return $this;
63
	}
64

                    
65
	public function getTitle()100%
66
	{
67
		return $this->title;
68
	}
69

                    
70
	public function addField(report\field $field)100%
71
	{
72
		$this->fields[] = $field->setLocale($this->locale);
73

                    
74
		return $this;
75
	}
76

                    
77
	public function resetFields()100%
78
	{
79
		$this->fields = array();
80

                    
81
		return $this;
82
	}
83

                    
84
	public function getFields()100%
85
	{
86
		return $this->fields;
87
	}
88

                    
89
	public function getWriters()100%
90
	{
91
		return $this->writers;
92
	}
93

                    
94
	public function handleEvent($event, observable $observable)100%
95
	{
96
		$this->lastSetFields = array();
97

                    
98
		foreach ($this->fields as $field)
99
		{
100
			if ($field->handleEvent($event, $observable) === true)
101
			{
102
				$this->lastSetFields[] = $field;
103
			}
104
		}
105

                    
106
		return $this;
107
	}
108

                    
109
	public function isOverridableBy(report $report)100%
110
	{
111
		return $report !== $this;
112
	}
113

                    
114
	protected function doAddWriter($writer)100%
115
	{
116
		$this->writers[] = $writer;
117

                    
118
		return $this;
119
	}
120
}