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