100% of 71OPs |
100% of 15Lines |
89% of 9Branches |
100% of 7Paths |
Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
---|---|---|---|---|---|---|---|---|
mageekguy\atoum\cli\prompt::__construct() | 28 | 100% | 8 | 100% | 4 | 75% | 2 | 100% |
mageekguy\atoum\cli\prompt::__toString() | 12 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\cli\prompt::setValue() | 10 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\cli\prompt::getValue() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\cli\prompt::setColorizer() | 9 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\cli\prompt::getColorizer() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
# | |
---|---|
1 |
<?php |
2 |
|
3 |
namespace mageekguy\atoum\cli; |
4 |
|
5 |
class prompt |
6 |
{ |
7 |
protected $value = ''; |
8 |
protected $colorizer = null; |
9 |
|
10 |
public function __construct($value = '', colorizer $colorizer = null)100% |
11 |
{ |
12 |
if ($colorizer === null) |
13 |
{ |
14 |
$colorizer = new colorizer(); |
15 |
} |
16 |
|
17 |
$this |
18 |
->setValue($value) |
19 |
->setColorizer($colorizer) |
20 |
; |
21 |
} |
22 |
|
23 |
public function __toString()100% |
24 |
{ |
25 |
return $this->colorizer->colorize($this->value); |
26 |
} |
27 |
|
28 |
public function setValue($value)100% |
29 |
{ |
30 |
$this->value = (string) $value; |
31 |
|
32 |
return $this; |
33 |
} |
34 |
|
35 |
public function getValue()100% |
36 |
{ |
37 |
return $this->value; |
38 |
} |
39 |
|
40 |
public function setColorizer(colorizer $colorizer)100% |
41 |
{ |
42 |
$this->colorizer = $colorizer; |
43 |
|
44 |
return $this; |
45 |
} |
46 |
|
47 |
public function getColorizer()100% |
48 |
{ |
49 |
return $this->colorizer; |
50 |
} |
51 |
} |