mageekguy\atoum\report\fields\runner\duration\cli: lines coverage

100% of 157

OPs

100% of 22

Lines

92% of 12

Branches

100% of 9

Paths
Method OPs OPs % Lines Line % Branches Branches % Paths Path %
mageekguy\atoum\report\fields\runner\duration\cli::__construct() 22 100% 6 100% 1 0% 1 100%
mageekguy\atoum\report\fields\runner\duration\cli::__toString() 69 100% 7 100% 5 100% 2 100%
mageekguy\atoum\report\fields\runner\duration\cli::setPrompt() 16 100% 2 100% 1 100% 1 100%
mageekguy\atoum\report\fields\runner\duration\cli::getPrompt() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\report\fields\runner\duration\cli::setTitleColorizer() 16 100% 2 100% 1 100% 1 100%
mageekguy\atoum\report\fields\runner\duration\cli::getTitleColorizer() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\report\fields\runner\duration\cli::setDurationColorizer() 16 100% 2 100% 1 100% 1 100%
mageekguy\atoum\report\fields\runner\duration\cli::getDurationColorizer() 6 100% 1 100% 1 100% 1 100%
#
1
<?php
2

                    
3
namespace mageekguy\atoum\report\fields\runner\duration;
4

                    
5
use
6
	mageekguy\atoum,
7
	mageekguy\atoum\locale,
8
	mageekguy\atoum\cli\prompt,
9
	mageekguy\atoum\cli\colorizer,
10
	mageekguy\atoum\report\fields\runner\duration
11
;
12

                    
13
class cli extends duration
14
{
15
	protected $prompt = null;
16
	protected $titleColorizer = null;
17
	protected $durationColorizer = null;
18

                    
19
	public function __construct()100%
20
	{
21
		parent::__construct();
22

                    
23
		$this
24
			->setPrompt()
25
			->setTitleColorizer()
26
			->setDurationColorizer()
27
		;
28
	}
29

                    
30
	public function __toString()100%
31
	{
32
		return $this->prompt .
33
			sprintf(
34
				$this->locale->_('%1$s: %2$s.'),
35
				$this->titleColorizer->colorize($this->locale->_('Running duration')),
36
				$this->durationColorizer->colorize($this->value === null ? $this->locale->_('unknown') : sprintf($this->locale->__('%4.2f second', '%4.2f seconds', $this->value), $this->value))
37
			) .
38
			PHP_EOL
39
		;
40
	}
41

                    
42
	public function setPrompt(prompt $prompt = null)100%
43
	{
44
		$this->prompt = $prompt ?: new prompt();
45

                    
46
		return $this;
47
	}
48

                    
49
	public function getPrompt()100%
50
	{
51
		return $this->prompt;
52
	}
53

                    
54
	public function setTitleColorizer(colorizer $colorizer = null)100%
55
	{
56
		$this->titleColorizer = $colorizer ?: new colorizer();
57

                    
58
		return $this;
59
	}
60

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

                    
66
	public function setDurationColorizer(colorizer $colorizer = null)100%
67
	{
68
		$this->durationColorizer = $colorizer ?: new colorizer();
69

                    
70
		return $this;
71
	}
72

                    
73
	public function getDurationColorizer()100%
74
	{
75
		return $this->durationColorizer;
76
	}
77
}