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