| Total Complexity | 5 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Coverage | 66.67% |
| Changes | 16 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 7 | final class LangInstall extends BaseCommand |
||
| 8 | { |
||
| 9 | protected $signature = 'lang:install' |
||
| 10 | . ' {locales* : Space-separated list of, eg: de tk it}' |
||
| 11 | . ' {--f|force : Override exiting files}' |
||
| 12 | . ' {--j|json : Install JSON files}'; |
||
| 13 | |||
| 14 | protected $description = 'Install new localizations.'; |
||
| 15 | |||
| 16 | 12 | public function handle() |
|
| 17 | { |
||
| 18 | 12 | $this->install( |
|
| 19 | 12 | $this->locales(), |
|
| 20 | 12 | $this->isForce(), |
|
| 21 | 12 | $this->isJson() |
|
| 22 | ); |
||
| 23 | |||
| 24 | $this->result |
||
| 25 | ->setMessage('Files were not copied.') |
||
| 26 | ->show(); |
||
| 27 | } |
||
| 28 | |||
| 29 | 12 | protected function install(array $locales, bool $force = false, bool $json = false): void |
|
| 30 | { |
||
| 31 | 12 | $locales === ['*'] |
|
| 32 | ? $this->installSome(Locale::available(), $force, $json) |
||
| 33 | 12 | : $this->installSome($locales, $force, $json); |
|
| 34 | } |
||
| 35 | |||
| 36 | 12 | protected function installSome(array $locales, bool $force = false, bool $json = false): void |
|
| 41 | ); |
||
| 42 | } |
||
| 43 | } |
||
| 45 |