100% of 66OPs |
100% of 9Lines |
100% of 6Branches |
100% of 6Paths |
Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
---|---|---|---|---|---|---|---|---|
mageekguy\atoum\report\fields\runner\coverage\cli::setPrompt() | 16 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\report\fields\runner\coverage\cli::getPrompt() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\report\fields\runner\coverage\cli::setTitleColorizer() | 16 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\report\fields\runner\coverage\cli::getTitleColorizer() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\report\fields\runner\coverage\cli::setCoverageColorizer() | 16 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\report\fields\runner\coverage\cli::getCoverageColorizer() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
# | |
---|---|
1 |
<?php |
2 |
|
3 |
namespace mageekguy\atoum\report\fields\runner\coverage; |
4 |
|
5 |
use |
6 |
mageekguy\atoum, |
7 |
mageekguy\atoum\report, |
8 |
mageekguy\atoum\runner, |
9 |
mageekguy\atoum\locale, |
10 |
mageekguy\atoum\cli\prompt, |
11 |
mageekguy\atoum\cli\colorizer |
12 |
; |
13 |
|
14 |
class cli extends report\fields\runner\coverage |
15 |
{ |
16 |
protected $prompt = null; |
17 |
protected $titleColorizer = null; |
18 |
protected $coverageColorizer = null; |
19 |
|
20 |
public function __construct() |
21 |
{ |
22 |
parent::__construct(); |
23 |
|
24 |
$this |
25 |
->setPrompt() |
26 |
->setTitleColorizer() |
27 |
->setCoverageColorizer() |
28 |
; |
29 |
} |
30 |
|
31 |
public function __toString() |
32 |
{ |
33 |
return $this->prompt . |
34 |
sprintf( |
35 |
'%s: %s.', |
36 |
$this->titleColorizer->colorize($this->locale->_('Code coverage')), |
37 |
$this->coverageColorizer->colorize( |
38 |
$this->coverage === null |
39 |
? |
40 |
$this->locale->_('unknown') |
41 |
: |
42 |
sprintf($this->locale->_('%3.2f%%'), round($this->coverage->getValue() * 100, 2)) |
43 |
) |
44 |
) . |
45 |
PHP_EOL |
46 |
; |
47 |
} |
48 |
|
49 |
public function setPrompt(prompt $prompt = null)100% |
50 |
{ |
51 |
$this->prompt = $prompt ?: new prompt(); |
52 |
|
53 |
return $this; |
54 |
} |
55 |
|
56 |
public function getPrompt()100% |
57 |
{ |
58 |
return $this->prompt; |
59 |
} |
60 |
|
61 |
public function setTitleColorizer(colorizer $colorizer = null)100% |
62 |
{ |
63 |
$this->titleColorizer = $colorizer ?: new colorizer(); |
64 |
|
65 |
return $this; |
66 |
} |
67 |
|
68 |
public function getTitleColorizer()100% |
69 |
{ |
70 |
return $this->titleColorizer; |
71 |
} |
72 |
|
73 |
public function setCoverageColorizer(colorizer $colorizer = null)100% |
74 |
{ |
75 |
$this->coverageColorizer = $colorizer ?: new colorizer(); |
76 |
|
77 |
return $this; |
78 |
} |
79 |
|
80 |
public function getCoverageColorizer()100% |
81 |
{ |
82 |
return $this->coverageColorizer; |
83 |
} |
84 |
} |