Total Complexity | 5 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
14 | class CounterReportFormatter extends Formatter |
||
15 | { |
||
16 | /** @var CounterReport */ |
||
17 | protected $report; |
||
18 | |||
19 | /** {@inheritdoc} */ |
||
20 | 9 | public function setStyles(): void |
|
21 | { |
||
22 | 9 | } |
|
23 | |||
24 | /** |
||
25 | * {@inheritdoc} |
||
26 | * @throws \Throwable |
||
27 | */ |
||
28 | 4 | public function getString(): string |
|
29 | { |
||
30 | 4 | if (DEFAULT_NAME === $name = $this->report->getName()) { |
|
31 | 3 | return $this->count(); |
|
32 | } |
||
33 | 1 | return $this->full($name); |
|
34 | } |
||
35 | |||
36 | /** |
||
37 | * @return string |
||
38 | * @throws \Throwable |
||
39 | */ |
||
40 | 3 | public function count(): string |
|
41 | { |
||
42 | return |
||
43 | 3 | sprintf( |
|
44 | 3 | 'Counter: %s(%s)%s', |
|
45 | 3 | $this->theme->comment((string)$this->report->getValue()), |
|
46 | 3 | $this->theme->dark((string)$this->report->getStep()), |
|
47 | 3 | PHP_EOL |
|
48 | ); |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * @param string $name |
||
53 | * @return string |
||
54 | * @throws \Throwable |
||
55 | */ |
||
56 | 1 | public function full(string $name): string |
|
65 | ); |
||
66 | } |
||
67 | } |
||
68 |