89% of 176OPs |
100% of 29Lines |
73% of 15Branches |
75% of 12Paths |
# | |
---|---|
1 |
<?php |
2 |
|
3 |
namespace mageekguy\atoum\report\fields\runner\php\version; |
4 |
|
5 |
use |
6 |
mageekguy\atoum\report, |
7 |
mageekguy\atoum\locale, |
8 |
mageekguy\atoum\cli\prompt, |
9 |
mageekguy\atoum\cli\colorizer |
10 |
; |
11 |
|
12 |
class cli extends report\fields\runner\php\version |
13 |
{ |
14 |
protected $titlePrompt = null; |
15 |
protected $titleColorizer = null; |
16 |
protected $versionPrompt = null; |
17 |
protected $versionColorizer = null; |
18 |
|
19 |
public function __construct()100% |
20 |
{ |
21 |
parent::__construct(); |
22 |
|
23 |
$this |
24 |
->setTitlePrompt() |
25 |
->setTitleColorizer() |
26 |
->setVersionPrompt() |
27 |
->setVersionColorizer() |
28 |
; |
29 |
} |
30 |
|
31 |
public function __toString()100% |
32 |
{ |
33 |
$string = |
34 |
$this->titlePrompt . |
35 |
sprintf( |
36 |
'%s:', |
37 |
$this->titleColorizer->colorize($this->locale->_('PHP version')) |
38 |
) . |
39 |
PHP_EOL |
40 |
; |
41 |
|
42 |
foreach (explode(PHP_EOL, $this->version) as $line) |
43 |
{ |
44 |
$string .= $this->versionPrompt . $this->versionColorizer->colorize(rtrim($line)) . PHP_EOL; |
45 |
} |
46 |
|
47 |
return $string; |
48 |
} |
49 |
|
50 |
public function setTitlePrompt(prompt $prompt = null)100% |
51 |
{ |
52 |
$this->titlePrompt = $prompt ?: new prompt(); |
53 |
|
54 |
return $this; |
55 |
} |
56 |
|
57 |
public function getTitlePrompt()100% |
58 |
{ |
59 |
return $this->titlePrompt; |
60 |
} |
61 |
|
62 |
public function setTitleColorizer(colorizer $colorizer = null)100% |
63 |
{ |
64 |
$this->titleColorizer = $colorizer ?: new colorizer(); |
65 |
|
66 |
return $this; |
67 |
} |
68 |
|
69 |
public function getTitleColorizer()100% |
70 |
{ |
71 |
return $this->titleColorizer; |
72 |
} |
73 |
|
74 |
public function setVersionPrompt(prompt $prompt = null)100% |
75 |
{ |
76 |
$this->versionPrompt = $prompt ?: new prompt(); |
77 |
|
78 |
return $this; |
79 |
} |
80 |
|
81 |
public function getVersionPrompt()100% |
82 |
{ |
83 |
return $this->versionPrompt; |
84 |
} |
85 |
|
86 |
public function setVersionColorizer(colorizer $colorizer = null)100% |
87 |
{ |
88 |
$this->versionColorizer = $colorizer ?: new colorizer(); |
89 |
|
90 |
return $this; |
91 |
} |
92 |
|
93 |
public function getVersionColorizer()100% |
94 |
{ |
95 |
return $this->versionColorizer; |
96 |
} |
97 |
} |