Conditions | 3 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
39 | public function process(TokenCollection $tokenCollection, Closure $callback): void |
||
40 | { |
||
41 | // tento kod by som mohol dat do nejakeho file updatera |
||
42 | $content = file_get_contents($tokenCollection->getFilePath()) ?: ''; |
||
43 | $newTexts = []; |
||
44 | foreach ($tokenCollection->getTokens() as $token) { |
||
45 | $newTexts[$token->getOriginalBlock()] = str_replace($token->getOriginalText(), $token->getTranslationCode(), $token->getOriginalBlock()); |
||
46 | $callback($token); |
||
47 | } |
||
48 | $content = str_replace(array_keys($newTexts), array_values($newTexts), $content); |
||
49 | file_put_contents($tokenCollection->getFilePath(), $content); |
||
50 | $this->saver->save($tokenCollection); |
||
51 | } |
||
53 |