Conditions | 3 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | protected function modify(Token $token): Token |
||
18 | { |
||
19 | $translationParams = ''; |
||
20 | if ($token->getTextParameters()) { |
||
21 | $translationParams .= ', ['; |
||
22 | $translationParamsList = []; |
||
23 | foreach ($token->getTextParameters() as $parameter => $value) { |
||
24 | $translationParamsList[] = "'$parameter' => $value"; |
||
25 | } |
||
26 | $translationParams .= implode(', ', $translationParamsList); |
||
27 | $translationParams .= ']'; |
||
28 | } |
||
29 | $translationPattern = str_replace(['%%%TRANSLATION_KEY%%%', '%%%TRANSLATION_PARAMS%%%'], [$token->getTranslationKey(), $translationParams], $this->translationPattern); |
||
30 | $token->changeTranslationCode($translationPattern); |
||
31 | return $token; |
||
32 | } |
||
34 |