@@ -84,7 +84,7 @@ |
||
84 | 84 | $ast = $parser->parse($code); |
85 | 85 | $traverser->traverse($ast); |
86 | 86 | } catch (Exception $e) { |
87 | - echo "Error analyzing file $filePath: " . $e->getMessage() . PHP_EOL; |
|
87 | + echo "Error analyzing file $filePath: ".$e->getMessage().PHP_EOL; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | return $result; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | { |
30 | 30 | $this->keys = &$keys; |
31 | 31 | $this->filePath = $filePath; |
32 | - $this->className = (string)pathinfo($filePath, PATHINFO_FILENAME); |
|
32 | + $this->className = (string) pathinfo($filePath, PATHINFO_FILENAME); |
|
33 | 33 | $this->config = $config; |
34 | 34 | } |
35 | 35 |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | public function __construct(?string $name = null) |
19 | 19 | { |
20 | 20 | parent::__construct($name); |
21 | - $this->translationFindConfig = require __DIR__ . '/Config.php'; |
|
21 | + $this->translationFindConfig = require __DIR__.'/Config.php'; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | protected function configure() |
25 | 25 | { |
26 | 26 | $this->setName('check:translations') |
27 | 27 | ->setDescription('Compare all translation keys with dictionaries(from files or api) for languages(default en_US)') |
28 | - ->addArgument('config', InputArgument::REQUIRED, 'Path to config file. Instance of ' . CheckDictionariesConfig::class . ' have to be returned') |
|
28 | + ->addArgument('config', InputArgument::REQUIRED, 'Path to config file. Instance of '.CheckDictionariesConfig::class.' have to be returned') |
|
29 | 29 | ->addOption('params', null, InputOption::VALUE_REQUIRED, 'Params for config in format --params="a=b&c=d"') |
30 | 30 | ->addOption('include', null, InputOption::VALUE_REQUIRED, 'Params for translationFindConfig in format json --include="{"CLASS_ARGPOS_METHODS": {"Module": { "2": ["addResource"] }}}"') |
31 | 31 | ->addOption('exclude', null, InputOption::VALUE_REQUIRED, 'Params for translationFindConfig in format json --exclude="{"CLASS_ARGPOS_METHODS": {"Module": { "2": ["addResource"] }}}"'); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | protected function execute(InputInterface $input, OutputInterface $output) |
37 | 37 | { |
38 | 38 | if (!is_file($input->getArgument('config'))) { |
39 | - throw new InvalidArgumentException('File "' . $input->getArgument('config') . '" does not exist'); |
|
39 | + throw new InvalidArgumentException('File "'.$input->getArgument('config').'" does not exist'); |
|
40 | 40 | } |
41 | 41 | parse_str($input->getOption('params'), $params); |
42 | 42 | extract($params); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | throw $checkDictionariesConfig; |
47 | 47 | } |
48 | 48 | if (!$checkDictionariesConfig instanceof CheckDictionariesConfig) { |
49 | - throw new InvalidConfigInstanceReturnedException('"' . (is_object($checkDictionariesConfig) ? get_class($checkDictionariesConfig) : $checkDictionariesConfig) . '" is not instance of ' . CheckDictionariesConfig::class); |
|
49 | + throw new InvalidConfigInstanceReturnedException('"'.(is_object($checkDictionariesConfig) ? get_class($checkDictionariesConfig) : $checkDictionariesConfig).'" is not instance of '.CheckDictionariesConfig::class); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | $output->writeln(''); |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | break; |
72 | 72 | } |
73 | 73 | foreach ($dictionaries as $lang => $dictionary) { |
74 | - $langText = !$onlyOneLang ? ' for language "' . $lang . '"' : ''; |
|
74 | + $langText = !$onlyOneLang ? ' for language "'.$lang.'"' : ''; |
|
75 | 75 | if (!isset($dictionary[$key])) { |
76 | 76 | $errors[] = sprintf( |
77 | - 'Missing translation for key "%s" ' . $langText . 'in file: %s:%s call: "%s"', |
|
77 | + 'Missing translation for key "%s" '.$langText.'in file: %s:%s call: "%s"', |
|
78 | 78 | $key, |
79 | 79 | $call['file'], |
80 | 80 | $call['line'], |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | // find plural bad key |
85 | 85 | $dictionaryTranslate = $dictionary[$key]; |
86 | 86 | $pluralKey = $call['arg'] ?? null; |
87 | - $pluralKeyInFile = $pluralKey ? '%' . $pluralKey . '%' : null; |
|
87 | + $pluralKeyInFile = $pluralKey ? '%'.$pluralKey.'%' : null; |
|
88 | 88 | if ($pluralKey && strpos($dictionaryTranslate, $pluralKeyInFile) === false) { |
89 | 89 | $errors[] = sprintf( |
90 | - 'Translation key "%s" ' . $langText . 'in file: %s:%s call: "%s" has bad plural key: %s for translation: "%s"', |
|
90 | + 'Translation key "%s" '.$langText.'in file: %s:%s call: "%s" has bad plural key: %s for translation: "%s"', |
|
91 | 91 | $key, |
92 | 92 | $call['file'], |
93 | 93 | $call['line'], |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | if ($pluralKey === null && preg_match('/.*%.+%.*/', $dictionaryTranslate) === false) { |
100 | 100 | $errors[] = sprintf( |
101 | - 'Translation key "%s" ' . $langText . 'in file: %s:%s call: "%s" has missing plural key for translation: "%s"', |
|
101 | + 'Translation key "%s" '.$langText.'in file: %s:%s call: "%s" has missing plural key for translation: "%s"', |
|
102 | 102 | $key, |
103 | 103 | $call['file'], |
104 | 104 | $call['line'], |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | $output->writeln(''); |
118 | - $output->writeln('<comment>' . count($errors) . ' errors found</comment>'); |
|
118 | + $output->writeln('<comment>'.count($errors).' errors found</comment>'); |
|
119 | 119 | return count($errors); |
120 | 120 | } |
121 | 121 |
@@ -24,18 +24,18 @@ |
||
24 | 24 | 'language_id' => $languageId ?? 'en_US', |
25 | 25 | ]; |
26 | 26 | $client = new Client(); |
27 | -$response = $client->get($url . '?' . http_build_query($params)); |
|
27 | +$response = $client->get($url.'?'.http_build_query($params)); |
|
28 | 28 | $response = json_decode($response->getBody()->getContents(), true); |
29 | 29 | $directories = $response['data']; |
30 | 30 | return new CheckDictionariesConfig($directories); |
31 | 31 | |
32 | 32 | function getComposerPackageName(string $basePath): ?string |
33 | 33 | { |
34 | - $composerJsonFilePath = $basePath . '/composer.json'; |
|
34 | + $composerJsonFilePath = $basePath.'/composer.json'; |
|
35 | 35 | if (is_file($composerJsonFilePath)) { |
36 | 36 | $composerJson = FileSystem::read($composerJsonFilePath); |
37 | 37 | $composerJsonData = json_decode($composerJson, true); |
38 | - return is_array($composerJsonData) ? (string)$composerJsonData['name'] : null; |
|
38 | + return is_array($composerJsonData) ? (string) $composerJsonData['name'] : null; |
|
39 | 39 | } |
40 | - throw new Exception('Not found composer.json on path: ' . $composerJsonFilePath); |
|
40 | + throw new Exception('Not found composer.json on path: '.$composerJsonFilePath); |
|
41 | 41 | } |
@@ -24,18 +24,18 @@ |
||
24 | 24 | 'language_id' => $languageId ?? 'en_US', |
25 | 25 | ]; |
26 | 26 | $client = new Client(); |
27 | -$response = $client->get($url . '?' . http_build_query($params)); |
|
27 | +$response = $client->get($url.'?'.http_build_query($params)); |
|
28 | 28 | $response = json_decode($response->getBody()->getContents(), true); |
29 | 29 | $directories = $response['data']; |
30 | 30 | return new CheckDictionariesConfig($directories); |
31 | 31 | |
32 | 32 | function getComposerPackageName(string $basePath): ?string |
33 | 33 | { |
34 | - $composerJsonFilePath = $basePath . '/composer.json'; |
|
34 | + $composerJsonFilePath = $basePath.'/composer.json'; |
|
35 | 35 | if (is_file($composerJsonFilePath)) { |
36 | 36 | $composerJson = FileSystem::read($composerJsonFilePath); |
37 | 37 | $composerJsonData = json_decode($composerJson, true); |
38 | - return is_array($composerJsonData) ? (string)$composerJsonData['name'] : null; |
|
38 | + return is_array($composerJsonData) ? (string) $composerJsonData['name'] : null; |
|
39 | 39 | } |
40 | - throw new Exception('Not found composer.json on path: ' . $composerJsonFilePath); |
|
40 | + throw new Exception('Not found composer.json on path: '.$composerJsonFilePath); |
|
41 | 41 | } |