mageekguy\atoum\writers\std: lines coverage

72% of 123

OPs

75% of 16

Lines

60% of 15

Branches

70% of 10

Paths
Method OPs OPs % Lines Line % Branches Branches % Paths Path %
mageekguy\atoum\writers\std::__construct() 18 100% 3 100% 1 0% 1 100%
mageekguy\atoum\writers\std::__destruct() 17 47% 5 60% 4 25% 2 50%
mageekguy\atoum\writers\std::setCli() 16 100% 2 100% 1 100% 1 100%
mageekguy\atoum\writers\std::getCli() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\writers\std::clear() 22 100% 1 100% 5 100% 2 100%
mageekguy\atoum\writers\std::writeRealtimeReport() 13 0% 1 0% 1 0% 1 0%
mageekguy\atoum\writers\std::writeAsynchronousReport() 12 0% 1 0% 1 0% 1 0%
mageekguy\atoum\writers\std::doWrite() 19 100% 2 100% 1 100% 1 100%
#
1
<?php
2

                    
3
namespace mageekguy\atoum\writers;
4

                    
5
use
6
	mageekguy\atoum,
7
	mageekguy\atoum\reports,
8
	mageekguy\atoum\exceptions,
9
	mageekguy\atoum\report\writers
10
;
11

                    
12
abstract class std extends atoum\writer implements writers\realtime, writers\asynchronous
13
{
14
	protected $cli = null;
15
	protected $resource = null;
16

                    
17
	public function __construct(atoum\cli $cli = null, atoum\adapter $adapter = null)100%
18
	{
19
		parent::__construct($adapter);
20

                    
21
		$this->setCli($cli);
22
	}
23

                    
24
	public function __destruct()60%
25
	{
26
		if ($this->resource !== null)
27
		{
28
			$this->adapter->fclose($this->resource);
29
		}
30
	}
31

                    
32
	public function setCli(atoum\cli $cli = null)100%
33
	{
34
		$this->cli = $cli ?: new atoum\cli();
35

                    
36
		return $this;
37
	}
38

                    
39
	public function getCli()100%
40
	{
41
		return $this->cli;
42
	}
43

                    
44
	public function clear()100%
45
	{
46
		return $this->doWrite($this->cli->isTerminal() === false ? PHP_EOL : "\033[1K\r");
47
	}
48

                    
49
	public function writeRealtimeReport(reports\realtime $report, $event)0%
50
	{
51
		return $this->write((string) $report);
52
	}
53

                    
54
	public function writeAsynchronousReport(reports\asynchronous $report)0%
55
	{
56
		return $this->write((string) $report);
57
	}
58

                    
59
	protected function doWrite($something)100%
60
	{
61
		$this->init()->adapter->fwrite($this->resource, $something);
62

                    
63
		return $this;
64
	}
65

                    
66
	protected abstract function init();
67
}