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