@@ -16,7 +16,7 @@  | 
                                                    ||
| 16 | 16 | |
| 17 | 17 | protected function modify(Token $token): Token  | 
                                                        
| 18 | 18 |      { | 
                                                        
| 19 | - $token->changeTranslationKey($this->translationKeyPrefix . $token->getTranslationKey());  | 
                                                        |
| 19 | + $token->changeTranslationKey($this->translationKeyPrefix.$token->getTranslationKey());  | 
                                                        |
| 20 | 20 | return $token;  | 
                                                        
| 21 | 21 | }  | 
                                                        
| 22 | 22 | }  | 
                                                        
@@ -27,7 +27,7 @@  | 
                                                    ||
| 27 | 27 |          for ($i = 0; $i < $matchesCount; ++$i) { | 
                                                        
| 28 | 28 | $paramName = $this->createParamName($matches[1][$i]);  | 
                                                        
| 29 | 29 | $paramValue = $this->createParamValue($matches[1][$i]);  | 
                                                        
| 30 | - $targetText = str_replace($matches[0][$i], '%' . $paramName . '%', $targetText);  | 
                                                        |
| 30 | + $targetText = str_replace($matches[0][$i], '%'.$paramName.'%', $targetText);  | 
                                                        |
| 31 | 31 | $textParameters[$paramName] = $paramValue;  | 
                                                        
| 32 | 32 | }  | 
                                                        
| 33 | 33 | |
@@ -1,9 +1,9 @@  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | |
| 3 | -return function () { | 
                                                        |
| 3 | +return function() { | 
                                                        |
| 4 | 4 | $files = [  | 
                                                        
| 5 | - __DIR__ . '/../../../autoload.php', // composer dependency  | 
                                                        |
| 6 | - __DIR__ . '/../vendor/autoload.php', // stand-alone package  | 
                                                        |
| 5 | + __DIR__.'/../../../autoload.php', // composer dependency  | 
                                                        |
| 6 | + __DIR__.'/../vendor/autoload.php', // stand-alone package  | 
                                                        |
| 7 | 7 | ];  | 
                                                        
| 8 | 8 |      foreach ($files as $file) { | 
                                                        
| 9 | 9 |          if (is_file($file)) { | 
                                                        
@@ -49,7 +49,7 @@ discard block  | 
                                                    ||
| 49 | 49 |      { | 
                                                        
| 50 | 50 |          foreach ($texts as $key => $value) { | 
                                                        
| 51 | 51 |              if (!is_array($value)) { | 
                                                        
| 52 | - $translations[$this->prefix . $key] = $value;  | 
                                                        |
| 52 | + $translations[$this->prefix.$key] = $value;  | 
                                                        |
| 53 | 53 | continue;  | 
                                                        
| 54 | 54 | }  | 
                                                        
| 55 | 55 | $translations = $this->arrayToFlat($this->shiftArrayKey($value, $key), $translations);  | 
                                                        
@@ -61,7 +61,7 @@ discard block  | 
                                                    ||
| 61 | 61 |      { | 
                                                        
| 62 | 62 | $newTexts = [];  | 
                                                        
| 63 | 63 |          foreach ($texts as $key => $value) { | 
                                                        
| 64 | - $newTexts[$parentKey . '.' . $key] = $value;  | 
                                                        |
| 64 | + $newTexts[$parentKey.'.'.$key] = $value;  | 
                                                        |
| 65 | 65 | }  | 
                                                        
| 66 | 66 | return $newTexts;  | 
                                                        
| 67 | 67 | }  | 
                                                        
@@ -74,7 +74,7 @@ discard block  | 
                                                    ||
| 74 | 74 | return $translations;  | 
                                                        
| 75 | 75 | }  | 
                                                        
| 76 | 76 |          if (isset($translations[$keyPart]) && is_string($translations[$keyPart])) { | 
                                                        
| 77 | -            $translations[$keyPart . '.' . implode('.', $translationKeyParts)] = $text; | 
                                                        |
| 77 | +            $translations[$keyPart.'.'.implode('.', $translationKeyParts)] = $text; | 
                                                        |
| 78 | 78 | return $translations;  | 
                                                        
| 79 | 79 | }  | 
                                                        
| 80 | 80 | $translations[$keyPart] = $this->addToTranslations($translations[$keyPart] ?? [], $translationKeyParts, $text);  | 
                                                        
@@ -15,11 +15,11 @@  | 
                                                    ||
| 15 | 15 | use Efabrica\TranslationsAutomatization\TokenModifier\PrefixTranslationKeyTokenModifier;  | 
                                                        
| 16 | 16 | |
| 17 | 17 | $basePath = rtrim($basePath, '/');  | 
                                                        
| 18 | -$storage = new NeonFileStorage($basePath . '/app/lang/dictionary.sk_SK.neon', ' ');  | 
                                                        |
| 18 | +$storage = new NeonFileStorage($basePath.'/app/lang/dictionary.sk_SK.neon', ' ');  | 
                                                        |
| 19 | 19 | $saver = new OneFileTranslationSaver($storage);  | 
                                                        
| 20 | 20 | $extractorConfig = new ExtractorConfig($saver);  | 
                                                        
| 21 | 21 | |
| 22 | -$fileFinder = new FileFinder([$basePath . '/app'], ['latte']);  | 
                                                        |
| 22 | +$fileFinder = new FileFinder([$basePath.'/app'], ['latte']);  | 
                                                        |
| 23 | 23 | |
| 24 | 24 | $textFinder = new RegexTextFinder();  | 
                                                        
| 25 | 25 |  $textFinder->addPattern('/\{\_(.*?)\}/', null); | 
                                                        
@@ -16,14 +16,14 @@ discard block  | 
                                                    ||
| 16 | 16 |      { | 
                                                        
| 17 | 17 |          $this->setName('translate') | 
                                                        
| 18 | 18 |              ->setDescription('Creates new language version of translated texts') | 
                                                        
| 19 | -            ->addArgument('config', InputArgument::REQUIRED, 'Path to config file. Instance of ' . TranslatorConfig::class  . ' have to be returned') | 
                                                        |
| 19 | +            ->addArgument('config', InputArgument::REQUIRED, 'Path to config file. Instance of '.TranslatorConfig::class.' have to be returned') | 
                                                        |
| 20 | 20 |              ->addOption('params', null, InputOption::VALUE_REQUIRED, 'Params for config in format a=b&c=d'); | 
                                                        
| 21 | 21 | }  | 
                                                        
| 22 | 22 | |
| 23 | 23 | protected function execute(InputInterface $input, OutputInterface $output)  | 
                                                        
| 24 | 24 |      { | 
                                                        
| 25 | 25 |          if (!is_file($input->getArgument('config'))) { | 
                                                        
| 26 | -            throw new InvalidArgumentException('File "' . $input->getArgument('config') . '" does not exist'); | 
                                                        |
| 26 | +            throw new InvalidArgumentException('File "'.$input->getArgument('config').'" does not exist'); | 
                                                        |
| 27 | 27 | }  | 
                                                        
| 28 | 28 |          parse_str($input->getOption('params'), $params); | 
                                                        
| 29 | 29 | extract($params);  | 
                                                        
@@ -33,7 +33,7 @@ discard block  | 
                                                    ||
| 33 | 33 | throw $translatorConfig;  | 
                                                        
| 34 | 34 | }  | 
                                                        
| 35 | 35 |          if (!$translatorConfig instanceof TranslatorConfig) { | 
                                                        
| 36 | -            throw new InvalidConfigInstanceReturnedException('"' . (is_object($translatorConfig) ? get_class($translatorConfig) : $translatorConfig) . '" is not instance of ' . TranslatorConfig::class); | 
                                                        |
| 36 | +            throw new InvalidConfigInstanceReturnedException('"'.(is_object($translatorConfig) ? get_class($translatorConfig) : $translatorConfig).'" is not instance of '.TranslatorConfig::class); | 
                                                        |
| 37 | 37 | }  | 
                                                        
| 38 | 38 | |
| 39 | 39 | $translatorConfig->translate();  | 
                                                        
@@ -18,14 +18,14 @@ discard block  | 
                                                    ||
| 18 | 18 |      { | 
                                                        
| 19 | 19 |          $this->setName('extract') | 
                                                        
| 20 | 20 |              ->setDescription('Finds non-translated texts, replaces them with translate tokens and store these texts to storage') | 
                                                        
| 21 | -            ->addArgument('config', InputArgument::REQUIRED, 'Path to config file. Instance of ' . ExtractorConfig::class  . ' have to be returned') | 
                                                        |
| 21 | +            ->addArgument('config', InputArgument::REQUIRED, 'Path to config file. Instance of '.ExtractorConfig::class.' have to be returned') | 
                                                        |
| 22 | 22 |              ->addOption('params', null, InputOption::VALUE_REQUIRED, 'Params for config in format --params="a=b&c=d"'); | 
                                                        
| 23 | 23 | }  | 
                                                        
| 24 | 24 | |
| 25 | 25 | protected function execute(InputInterface $input, OutputInterface $output)  | 
                                                        
| 26 | 26 |      { | 
                                                        
| 27 | 27 |          if (!is_file($input->getArgument('config'))) { | 
                                                        
| 28 | -            throw new InvalidArgumentException('File "' . $input->getArgument('config') . '" does not exist'); | 
                                                        |
| 28 | +            throw new InvalidArgumentException('File "'.$input->getArgument('config').'" does not exist'); | 
                                                        |
| 29 | 29 | }  | 
                                                        
| 30 | 30 |          parse_str($input->getOption('params'), $params); | 
                                                        
| 31 | 31 | extract($params);  | 
                                                        
@@ -35,7 +35,7 @@ discard block  | 
                                                    ||
| 35 | 35 | throw $extractorConfig;  | 
                                                        
| 36 | 36 | }  | 
                                                        
| 37 | 37 |          if (!$extractorConfig instanceof ExtractorConfig) { | 
                                                        
| 38 | -            throw new InvalidConfigInstanceReturnedException('"' . (is_object($extractorConfig) ? get_class($extractorConfig) : $extractorConfig) . '" is not instance of ' . ExtractorConfig::class); | 
                                                        |
| 38 | +            throw new InvalidConfigInstanceReturnedException('"'.(is_object($extractorConfig) ? get_class($extractorConfig) : $extractorConfig).'" is not instance of '.ExtractorConfig::class); | 
                                                        |
| 39 | 39 | }  | 
                                                        
| 40 | 40 | |
| 41 | 41 |          $output->writeln(''); | 
                                                        
@@ -45,19 +45,19 @@ discard block  | 
                                                    ||
| 45 | 45 |          foreach ($tokenCollections as $tokenCollection) { | 
                                                        
| 46 | 46 | $totalTokens += count($tokenCollection->getTokens());  | 
                                                        
| 47 | 47 | }  | 
                                                        
| 48 | - $output->writeln($totalTokens . ' tokens found');  | 
                                                        |
| 48 | + $output->writeln($totalTokens.' tokens found');  | 
                                                        |
| 49 | 49 |          $output->writeln('Processing tokens...'); | 
                                                        
| 50 | 50 |          $output->writeln(''); | 
                                                        
| 51 | 51 | |
| 52 | 52 | $progressBar = new ProgressBar($output, $totalTokens);  | 
                                                        
| 53 | 53 | $tokensReplaced = 0;  | 
                                                        
| 54 | 54 |          foreach ($tokenCollections as $tokenCollection) { | 
                                                        
| 55 | -            $extractorConfig->process($tokenCollection, function (Token $token) use ($progressBar, &$tokensReplaced) { | 
                                                        |
| 55 | +            $extractorConfig->process($tokenCollection, function(Token $token) use ($progressBar, &$tokensReplaced) { | 
                                                        |
| 56 | 56 | $progressBar->advance();  | 
                                                        
| 57 | 57 | $tokensReplaced++;  | 
                                                        
| 58 | 58 | });  | 
                                                        
| 59 | 59 | }  | 
                                                        
| 60 | 60 |          $output->writeln("\n\n"); | 
                                                        
| 61 | -        $output->writeln('<comment>' . $tokensReplaced . ' tokens replaced</comment>'); | 
                                                        |
| 61 | +        $output->writeln('<comment>'.$tokensReplaced.' tokens replaced</comment>'); | 
                                                        |
| 62 | 62 | }  | 
                                                        
| 63 | 63 | }  | 
                                                        
@@ -18,9 +18,9 @@  | 
                                                    ||
| 18 | 18 | |
| 19 | 19 | public function modifyAll(TokenCollection $tokenCollection): TokenCollection  | 
                                                        
| 20 | 20 |      { | 
                                                        
| 21 | -        $pathParts = array_unique(explode('/', str_replace($this->basePath . '/', '', pathinfo($tokenCollection->getFilePath(), PATHINFO_DIRNAME) . '/' . pathinfo($tokenCollection->getFilePath(), PATHINFO_FILENAME)))); | 
                                                        |
| 21 | +        $pathParts = array_unique(explode('/', str_replace($this->basePath.'/', '', pathinfo($tokenCollection->getFilePath(), PATHINFO_DIRNAME).'/'.pathinfo($tokenCollection->getFilePath(), PATHINFO_FILENAME)))); | 
                                                        |
| 22 | 22 |          foreach ($tokenCollection->getTokens() as $token) { | 
                                                        
| 23 | -            $newKeyParts = array_filter(array_map('strtolower', $pathParts), function ($pathPart) { | 
                                                        |
| 23 | +            $newKeyParts = array_filter(array_map('strtolower', $pathParts), function($pathPart) { | 
                                                        |
| 24 | 24 | return !in_array($pathPart, $this->excludeDirectoryNames);  | 
                                                        
| 25 | 25 | });  | 
                                                        
| 26 | 26 | $newKeyParts[] = $token->getTranslationKey();  |