mageekguy\atoum\template\data: lines coverage

89% of 219

OPs

88% of 41

Lines

87% of 38

Branches

92% of 26

Paths
Method OPs OPs % Lines Line % Branches Branches % Paths Path %
mageekguy\atoum\template\data::__construct() 10 100% 2 100% 1 0% 1 100%
mageekguy\atoum\template\data::__toString() 9 100% 1 100% 1 100% 1 100%
mageekguy\atoum\template\data::resetData() 9 100% 2 100% 1 100% 1 100%
mageekguy\atoum\template\data::getData() 13 100% 1 100% 5 100% 2 100%
mageekguy\atoum\template\data::setData() 15 100% 1 100% 1 100% 1 100%
mageekguy\atoum\template\data::addData() 16 100% 6 100% 4 100% 2 100%
mageekguy\atoum\template\data::setParent() 12 100% 2 100% 1 100% 1 100%
mageekguy\atoum\template\data::getParent() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\template\data::getRoot() 16 100% 5 100% 5 100% 2 100%
mageekguy\atoum\template\data::isRoot() 8 100% 1 100% 1 100% 1 100%
mageekguy\atoum\template\data::parentIsSet() 8 100% 1 100% 1 100% 1 100%
mageekguy\atoum\template\data::unsetParent() 21 100% 5 100% 4 100% 2 100%
mageekguy\atoum\template\data::getTag() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\template\data::getId() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\template\data::build() 5 100% 1 100% 1 100% 1 100%
mageekguy\atoum\template\data::addToParent() 25 0% 5 0% 4 0% 2 0%
mageekguy\atoum\template\data::getByTag() 7 100% 1 100% 1 100% 1 100%
mageekguy\atoum\template\data::getById() 8 100% 1 100% 1 100% 1 100%
mageekguy\atoum\template\data::hasChildren() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\template\data::getChild() 7 100% 1 100% 1 100% 1 100%
mageekguy\atoum\template\data::getChildren() 6 100% 1 100% 1 100% 1 100%
#
1
<?php
2

                    
3
namespace mageekguy\atoum\template;
4

                    
5
use
6
	mageekguy\atoum
7
;
8

                    
9
class data
10
{
11
	protected $parent = null;
12
	protected $rank = null;
13
	protected $data = null;
14

                    
15
	public function __construct($data = null)100%
16
	{
17
		$this->setData($data);
18
	}
19

                    
20
	public function __toString()100%
21
	{
22
		return $this->getData();
23
	}
24

                    
25
	public function resetData()100%
26
	{
27
		$this->data = null;
28

                    
29
		return $this;
30
	}
31

                    
32
	public function getData()100%
33
	{
34
		return ($this->data === null ? '' : $this->data);
35
	}
36

                    
37
	public function setData($data)100%
38
	{
39
		return $this->resetData()->addData($data);
40
	}
41

                    
42
	public function addData($data)100%
43
	{
44
		$data = (string) $data;
45

                    
46
		if ($data != '')
47
		{
48
			$this->data .= $data;
49
		}
50

                    
51
		return $this;
52
	}
53

                    
54
	public function setParent(atoum\template $parent)100%
55
	{
56
		$parent->addChild($this);
57

                    
58
		return $this;
59
	}
60

                    
61
	public function getParent()100%
62
	{
63
		return $this->parent;
64
	}
65

                    
66
	public function getRoot()100%
67
	{
68
		$root = $this;
69

                    
70
		while ($root->parent !== null)
71
		{
72
			$root = $root->parent;
73
		}
74

                    
75
		return $root;
76
	}
77

                    
78
	public function isRoot()100%
79
	{
80
		return ($this->parent === null);
81
	}
82

                    
83
	public function parentIsSet()100%
84
	{
85
		return ($this->parent !== null);
86
	}
87

                    
88
	public function unsetParent()100%
89
	{
90
		if ($this->parentIsSet() === true)
91
		{
92
			$this->parent->deleteChild($this);
93
		}
94

                    
95
		return $this;
96
	}
97

                    
98
	public function build()100%
99
	{
100
		return $this;
101
	}
102

                    
103
	public function addToParent()0%
104
	{
105
		if ($this->build()->parentIsSet() === true)
106
		{
107
			$this->parent->addData($this);
108
		}
109

                    
110
		return $this;
111
	}
112

                    
113
	public function getTag()100%
114
	{
115
		return null;
116
	}
117

                    
118
	public function getId()100%
119
	{
120
		return null;
121
	}
122

                    
123
	public function getByTag($tag)100%
124
	{
125
		return array();
126
	}
127

                    
128
	public function getById($id, $fromRoot = true)100%
129
	{
130
		return null;
131
	}
132

                    
133
	public function hasChildren()100%
134
	{
135
		return false;
136
	}
137

                    
138
	public function getChild($rank)100%
139
	{
140
		return null;
141
	}
142

                    
143
	public function getChildren()100%
144
	{
145
		return array();
146
	}
147
}