| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | 6 | public function modifyAll(TokenCollection $tokenCollection): TokenCollection |
|
| 20 | { |
||
| 21 | 6 | $pathParts = explode('/', str_replace($this->basePath . '/', '', $tokenCollection->getFilePath())); |
|
| 22 | 6 | array_pop($pathParts); |
|
| 23 | 6 | foreach ($tokenCollection->getTokens() as $token) { |
|
| 24 | $newKeyParts = array_filter(array_map('strtolower', $pathParts), function ($pathPart) { |
||
| 25 | 6 | return !in_array($pathPart, $this->excludeDirectoryNames); |
|
| 26 | 6 | }); |
|
| 27 | 6 | $newKeyParts[] = $token->getTranslationKey(); |
|
| 28 | 6 | $token->changeTranslationKey(implode('.', $newKeyParts)); |
|
| 29 | } |
||
| 30 | 6 | return $tokenCollection; |
|
| 31 | } |
||
| 33 |