| Total Complexity | 5 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 10 | final class TsEnumGenerator extends AbstractGenerator |
||
| 11 | { |
||
| 12 | private string $name; |
||
| 13 | private array $items; |
||
| 14 | |||
| 15 | private EnumRowItemBuilderInterface $rowFormatter; |
||
| 16 | |||
| 17 | public function __construct(string $name, array $items) |
||
| 23 | } |
||
| 24 | |||
| 25 | public function withRowFormatter(EnumRowItemBuilderInterface $formatter): self |
||
| 26 | { |
||
| 27 | $this->rowFormatter = $formatter; |
||
| 28 | |||
| 29 | return $this; |
||
| 30 | } |
||
| 31 | |||
| 32 | public function generate(): string |
||
| 33 | { |
||
| 34 | return sprintf(<<<JS |
||
| 35 | export enum %s%s{ |
||
| 36 | %s |
||
| 37 | }; |
||
| 38 | JS |
||
| 39 | , $this->name, $this->indentation, $this->generateItemRows()); |
||
| 40 | } |
||
| 41 | |||
| 42 | private function generateItemRows(): string |
||
| 50 | } |
||
| 51 | } |
||
| 52 |