| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | 75 | public function normalize(string $text, $context = null): string |
|
| 30 | { |
||
| 31 | 75 | $slug = $this->slugNormalizer->normalize($text, $context); |
|
| 32 | |||
| 33 | 75 | if (!isset($this->usages[$slug])) { |
|
| 34 | 75 | $this->usages[$slug] = 1; |
|
| 35 | |||
| 36 | 75 | return $slug; |
|
| 37 | } |
||
| 38 | |||
| 39 | 9 | $count = $this->usages[$slug]++; |
|
| 40 | |||
| 41 | 9 | return $slug . '-' . $count; |
|
| 42 | } |
||
| 43 | } |
||
| 44 |