| Conditions | 3 |
| Paths | 2 |
| Total Lines | 26 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public function handle(): void |
||
| 16 | { |
||
| 17 | $langCode = $this->argument('langCode'); |
||
| 18 | $language = Language::findByCode(LanguageCode::tryFrom($langCode)); |
||
| 19 | |||
| 20 | if (!$language || !$language->activated_at) { |
||
| 21 | $this->error('Language not found or not activated'); |
||
| 22 | |||
| 23 | return; |
||
| 24 | } |
||
| 25 | |||
| 26 | // key => text |
||
| 27 | $translatedTexts = Translation::all(['key', 'translations']) |
||
| 28 | ->mapWithKeys(function (Translation $translation) use ($langCode) { |
||
| 29 | return [ |
||
| 30 | $translation->key => $translation->translations[$langCode] ?? '', |
||
| 31 | ]; |
||
| 32 | }); |
||
| 33 | |||
| 34 | $langFilePath = lang_path("$langCode.json"); |
||
| 35 | |||
| 36 | // write |
||
| 37 | file_put_contents($langFilePath, $translatedTexts); |
||
| 38 | |||
| 39 | $this->info("All translations of $langCode is exported successfully."); |
||
| 40 | $this->info('Path: ' . $langFilePath); |
||
| 41 | } |
||
| 43 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths