mageekguy\atoum\php\tokenizer\iterator\value: lines coverage

98% of 59

OPs

100% of 13

Lines

90% of 10

Branches

100% of 5

Paths
Method OPs OPs % Lines Line % Branches Branches % Paths Path %
mageekguy\atoum\php\tokenizer\iterator\value::setParent() 26 96% 5 100% 4 75% 2 100%
mageekguy\atoum\php\tokenizer\iterator\value::getParent() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\php\tokenizer\iterator\value::getRoot() 27 100% 7 100% 5 100% 2 100%
#
1
<?php
2

                    
3
namespace mageekguy\atoum\php\tokenizer\iterator;
4

                    
5
use
6
	mageekguy\atoum\exceptions
7
;
8

                    
9
abstract class value implements \iterator, \countable
10
{
11
	protected $parent = null;
12

                    
13
	public function setParent(value $parent)100%
14
	{
15
		if ($this->parent !== null)
16
		{
17
			throw new exceptions\runtime('Parent is already set');
18
		}
19

                    
20
		$parent->append($this);
21

                    
22
		return $this;
23
	}
24

                    
25
	public function getParent()100%
26
	{
27
		return $this->parent;
28
	}
29

                    
30
	public function getRoot()100%
31
	{
32
		$root = null;
33

                    
34
		$parent = $this->getParent();
35

                    
36
		while ($parent !== null)
37
		{
38
			$root = $parent;
39

                    
40
			$parent = $parent->getParent();
41
		}
42

                    
43
		return $root;
44
	}
45

                    
46
	public abstract function __toString();
47
	public abstract function prev();
48
	public abstract function end();
49
	public abstract function append(value $value);
50
	public abstract function getValue();
51
	public abstract function seek($key);
52
}