| Total Complexity | 4 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | final class ChangesCountNameGenerator implements NameGeneratorInterface |
||
| 12 | { |
||
| 13 | public function generate(Atomizer $atomizer): string |
||
| 14 | { |
||
| 15 | $collector = new Collector(); |
||
| 16 | $map = []; |
||
| 17 | foreach ($collector->collect($atomizer) as $pair) { |
||
| 18 | $key = $this->changeToString($pair[0]); |
||
| 19 | $map[$key] ??= 0; |
||
| 20 | $map[$key]++; |
||
| 21 | } |
||
| 22 | |||
| 23 | $result = []; |
||
| 24 | foreach ($map as $key => $cnt) { |
||
| 25 | $result[] = "{$key}{$cnt}"; |
||
| 26 | } |
||
| 27 | |||
| 28 | return \implode('_', $result); |
||
| 29 | } |
||
| 30 | |||
| 31 | private function changeToString(ChangeType $change): string |
||
| 47 | }; |
||
| 48 | } |
||
| 50 |